docker run ubuntu echo hello docker
docker run nginx
^Croot@iZbp1berl2oy3e3vt5476fZ:~# docker run nginx
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
Ver imagenes
docker images
Ejecutar docker
docker run -p 8080:80 -d nginx
Puede visitar:
Ver el contenedor que se está ejecutando actualmente
docker ps
Crea un archivo html
<html>
<h1> Docker is fun 123</h1>
</html>
Copiar la página a una imagen
docker cp index.html 173d54b314c1://usr/share/nginx/html
Mira el efecto:
¡mágico! ! !
Detener un contenedor docker
docker stop 173d54b314c1
No puedo acceder normalmente
Reiniciar de nuevo
docker run -p 8080:80 -d nginx
Efecto visita:
Ahora guarda esa página
docker commit -m "fun hlg" a3602cc5370e
Se crea una nueva imagen en este momento
Agrega un nombre ahora
docker commit -m "fun hlg" a3602cc5370e nginx-fun-hlg
Eliminar comando:
docker rmi
Ver actualmente en ejecución
docker ps
Detener:
docker stop
root@iZbp1berl2oy3e3vt5476fZ:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a3602cc5370e nginx "/docker-entrypoint.…" 13 minutes ago Up 13 minutes 0.0.0.0:8080->80/tcp jovial_kare
root@iZbp1berl2oy3e3vt5476fZ:~# docker stop a3602cc5370e
a3602cc5370e
root@iZbp1berl2oy3e3vt5476fZ:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
root@iZbp1berl2oy3e3vt5476fZ:~#
Ver todos los contenedores
docker ps -a
root@iZbp1berl2oy3e3vt5476fZ:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a3602cc5370e nginx "/docker-entrypoint.…" 16 minutes ago Exited (0) About a minute ago jovial_kare
173d54b314c1 nginx "/docker-entrypoint.…" 30 minutes ago Exited (0) 19 minutes ago agitated_jennings
9d827f501f82 nginx "/docker-entrypoint.…" 34 minutes ago Exited (0) 33 minutes ago elastic_hugle
857d94349bca nginx "/docker-entrypoint.…" 38 minutes ago Exited (0) 34 minutes ago eloquent_ganguly
fb0eb55c9b8b ubuntu "echo hello docker" 41 minutes ago Exited (0) 41 minutes ago adoring_dirac
72d47427e376 ubuntu "echo hello docker" 42 minutes ago Exited (0) 42 minutes ago serene_wescoff
root@iZbp1berl2oy3e3vt5476fZ:~#
Eliminar
docker rm
root@iZbp1berl2oy3e3vt5476fZ:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a3602cc5370e nginx "/docker-entrypoint.…" 16 minutes ago Exited (0) About a minute ago jovial_kare
173d54b314c1 nginx "/docker-entrypoint.…" 30 minutes ago Exited (0) 19 minutes ago agitated_jennings
9d827f501f82 nginx "/docker-entrypoint.…" 34 minutes ago Exited (0) 33 minutes ago elastic_hugle
857d94349bca nginx "/docker-entrypoint.…" 38 minutes ago Exited (0) 34 minutes ago eloquent_ganguly
fb0eb55c9b8b ubuntu "echo hello docker" 41 minutes ago Exited (0) 41 minutes ago adoring_dirac
72d47427e376 ubuntu "echo hello docker" 42 minutes ago Exited (0) 42 minutes ago serene_wescoff
root@iZbp1berl2oy3e3vt5476fZ:~# docker rm fb0eb55c9b8b
fb0eb55c9b8b
root@iZbp1berl2oy3e3vt5476fZ:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a3602cc5370e nginx "/docker-entrypoint.…" 18 minutes ago Exited (0) 3 minutes ago jovial_kare
173d54b314c1 nginx "/docker-entrypoint.…" 33 minutes ago Exited (0) 21 minutes ago agitated_jennings
9d827f501f82 nginx "/docker-entrypoint.…" 37 minutes ago Exited (0) 35 minutes ago elastic_hugle
857d94349bca nginx "/docker-entrypoint.…" 41 minutes ago Exited (0) 37 minutes ago eloquent_ganguly
72d47427e376 ubuntu "echo hello docker" 44 minutes ago Exited (0) 44 minutes ago serene_wescoff
root@iZbp1berl2oy3e3vt5476fZ:~#