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
| root@ubuntu2204:~# apt update root@ubuntu2204:~# apt install -y docker.io root@ubuntu2204:~# docker pull nginx:1.24.0
root@ubuntu2204:~# docker images REPOSITORY TAG IMAGE ID CREATED SIZE nginx 1.24.0 6c0218f16876 13 months ago 142MBtu2204:~# docker pull nginx:1.24.0
root@ubuntu2204:~# docker run -d --name nginx -p 80:80 nginx:1.24.0 9d8f1f98879be8b561f29dd78aa4291e3e8c3adc44b3313fc909bb6ecb12fee6
root@ubuntu2204:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9d8f1f98879b nginx:1.24.0 "/docker-entrypoint.…" 2 minutes ago Up 2 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp nginx
root@ubuntu2204:~# docker exec -it nginx bash root@9d8f1f98879b:/# nginx -T root@9d8f1f98879b:/# echo "My Nginx images with nginx:1.24.0" > /usr/share/nginx/html/index.html root@9d8f1f98879b:/# cat /usr/share/nginx/html/index.html My Nginx images with nginx:1.24.0 root@9d8f1f98879b:/# exit
root@ubuntu2204:~# curl 10.0.0.7 My Nginx images with nginx:1.24.0
root@ubuntu2204:~# docker commit nginx mynginx:1.24.0 sha256:6cdae199f0ed257a7725af4f11a33a962fe7d23eb72db849b5755d62f7cb13b8
root@ubuntu2204:~# docker images REPOSITORY TAG IMAGE ID CREATED SIZE mynginx 1.24.0 6cdae199f0ed 8 seconds ago 142MB nginx 1.24.0 6c0218f16876 13 months ago 142MB
|