1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| tom@tom-virtual-machine:~$ sudo docker run --rm --name my_nginx -d -p 80:80 nginx e5a46ddf376cea6f362cd8b6de6460fe0971f4cdf515d9e4897bb52df55dc9d3 tom@tom-virtual-machine:~$ sudo docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e5a46ddf376c nginx "/docker-entrypoint.…" 9 seconds ago Up 7 seconds 0.0.0.0:80->80/tcp, :::80->80/tcp my_nginx tom@tom-virtual-machine:~$ sudo docker exec -it my_nginx /bin/bash root@e5a46ddf376c:/ bin boot dev docker-entrypoint.d docker-entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var root@e5a46ddf376c:/ doc/ doc-base/ root@e5a46ddf376c:/ doc/ doc-base/ root@e5a46ddf376c:/ doc/ doc-base/ root@e5a46ddf376c:/ root@e5a46ddf376c:/usr/share/nginx/html root@e5a46ddf376c:/usr/share/nginx/html 50x.html index.html
root@e5a46ddf376c:/usr/share/nginx/html root@e5a46ddf376c:/usr/share/nginx/html exit
tom@tom-virtual-machine:~$ sudo docker commit -a szy -m 'This is my nginx image' my_nginx mynginx:1 sha256:d6eba235464994c8bc5ed86e1a24d8745629519516b1d51cf68fa3982ae05dd0 tom@tom-virtual-machine:~$ sudo docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE mynginx 1 d6eba2354649 11 seconds ago 141MB nginx latest 605c77e624dd 23 months ago 141MB centos latest 5d0da3dc9764 2 years ago 231MB tom@tom-virtual-machine:~$ sudo docker stop e e tom@tom-virtual-machine:~$ sudo docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
tom@tom-virtual-machine:~$ sudo docker run --rm --name mynginx -d -p 80:80 mynginx:1 888eb2cc3cfae09c9b090ead7058ca34c7ea0ae36b4dbaa72e52d497879ad172
|