1. Run Docker base image like ubuntu
[node1] (local) root@192.168.0.23 ~
$ docker run -it ubuntu bash
root@153c1eb1d2c4:/# apt-get update
Get:1 http://security.ubuntu.com/ubuntu
focal-security InRelease [107 kB]
...
Reading package lists... Done
root@153c1eb1d2c4:/# apt-get install -y figlet
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
figlet
root@153c1eb1d2c4:/# figlet "hello docker"
_ _ _ _ _
| |__ ___| | | ___ __| | ___ ___| | _____ _ __
| '_ \ / _ \ | |/ _ \ / _` |/ _ \ / __| |/ / _ \ '__|
| | | | __/ | | (_) | (_| | (_) | (__| < __/ |
|_| |_|\___|_|_|\___/ \__,_|\___/ \___|_|\_\___|_|
root@153c1eb1d2c4:/# exit
[node1] (local) root@192.168.0.23 ~
$ docker ps -a
ONTAINER ID IMAGE COMMAND CREATED STATUS PORTSNAMES
153c1eb1d2c4 ubuntu "bash" 6 minutes ago Exited (127) About a minute ago
$ docker commit --author lqwangxg --message "save as image" 153
sha256:7ff21c05ee7d57d44f7733e0d116080e0ac66c432836211403d82fd18c9ad36f
$ docker images
EPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> 7ff21c05ee7d 12 seconds ago 97.2MB
$ docker tag 7ff ubuntu-figlet
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu-figlet latest 7ff21c05ee7d 2 minutes ago 97.2MB
[node1] (local) root@192.168.0.23 ~ $ docker run -it ubuntu bash root@153c1eb1d2c4:/# apt-get update Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB] ... Reading package lists... Done root@153c1eb1d2c4:/# apt-get install -y figlet Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: figlet root@153c1eb1d2c4:/# figlet "hello docker" _ _ _ _ _ | |__ ___| | | ___ __| | ___ ___| | _____ _ __ | '_ \ / _ \ | |/ _ \ / _` |/ _ \ / __| |/ / _ \ '__| | | | | __/ | | (_) | (_| | (_) | (__| < __/ | |_| |_|\___|_|_|\___/ \__,_|\___/ \___|_|\_\___|_|
root@153c1eb1d2c4:/# exit
[node1] (local) root@192.168.0.23 ~ $ docker ps -a ONTAINER ID IMAGE COMMAND CREATED STATUS PORTSNAMES 153c1eb1d2c4 ubuntu "bash" 6 minutes ago Exited (127) About a minute ago $ docker commit --author lqwangxg --message "save as image" 153 sha256:7ff21c05ee7d57d44f7733e0d116080e0ac66c432836211403d82fd18c9ad36f $ docker images EPOSITORY TAG IMAGE ID CREATED SIZE <none> <none> 7ff21c05ee7d 12 seconds ago 97.2MB $ docker tag 7ff ubuntu-figlet $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu-figlet latest 7ff21c05ee7d 2 minutes ago 97.2MB