Manage multiple containers:
nginx:
docker container run --publish 80:80 -d --name nginx_web nginx
mysql:
docker container run --publish 3306:3306 -d -e MYSQL_RANDOM_ROOT_PASSWORD=yes --name mysql_db mysql
httpd:
docker container run --publish 8080:80 -d --name httpd_web httpd
PS C:\Users\MOHI\code> docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
PS C:\Users\MOHI\code> docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
PS C:\Users\MOHI\code> docker container run --publish 80:80 -d --name nginx_web nginx
588f4f1ca028e6cd80a952a7ecd456093f52d10c22c2444d61d56fe0704fdf6f
PS C:\Users\MOHI\code> docker container run --publish 3306:3306 -d --env MYSQL_RANDOM_ROOT_PASSWORD=yes --name mysql_db mysql
Unable to find image 'mysql:latest' locally
latest: Pulling from library/mysql
80369df48736: Pull complete
e8f52315cb10: Pull complete
cf2189b391fc: Pull complete
cc98f645c682: Pull complete
27a27ac83f74: Pull complete
fa1f04453414: Pull complete
d45bf7d22d33: Pull complete
3dbac26e409c: Pull complete
9017140fb8c1: Pull complete
b76dda2673ae: Pull complete
bea9eb46d12a: Pull complete
e1f050a38d0f: Pull complete
Digest: sha256:7345ce4ce6f0c1771d01fa333b8edb2c606ca59d385f69575f8e3e2ec6695eee
Status: Downloaded newer image for mysql:latest
714f6bc54651d4d46efa084fd4b69c0cdafcbaea4ed0dd2d4593640f4200a9e9
PS C:\Users\MOHI\code> docker container run --publish 8080:80 -d --name httpd_web httpd
Unable to find image 'httpd:latest' locally
latest: Pulling from library/httpd
8d691f585fa8: Already exists
8eb779d8bd44: Pull complete
574add29ec5c: Pull complete
30d7fa9ec230: Pull complete
ede292f2b031: Pull complete
Digest: sha256:35fcab73dc9ae55db5c4ac33f5e0c7e76b7735aaddb628366bab04db6f8ae96e
Status: Downloaded newer image for httpd:latest
80acd2549abb38b95b1382b58ba768579b113a50c640be91a67292063ff987bc
PS C:\Users\MOHI\code> docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
80acd2549abb httpd "httpd-foreground" 54 seconds ago Up 47 seconds 0.0.0.0:8080->80/tcp httpd_web
714f6bc54651 mysql "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql_db
588f4f1ca028 nginx "nginx -g 'daemon of…" 4 minutes ago Up 3 minutes 0.0.0.0:80->80/tcp nginx_web
PS C:\Users\MOHI\code> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
80acd2549abb httpd "httpd-foreground" 6 minutes ago Up 6 minutes 0.0.0.0:8080->80/tcp httpd_web
714f6bc54651 mysql "docker-entrypoint.s…" 7 minutes ago Up 7 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql_db
588f4f1ca028 nginx "nginx -g 'daemon of…" 9 minutes ago Up 9 minutes 0.0.0.0:80->80/tcp nginx_web
PS C:\Users\MOHI\code> docker container stop httpd_web mysql_db nginx_web
httpd_web
mysql_db
nginx_web
PS C:\Users\MOHI\code> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
PS C:\Users\MOHI\code> docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
80acd2549abb httpd "httpd-foreground" 11 minutes ago Exited (0) 44 seconds ago httpd_web
714f6bc54651 mysql "docker-entrypoint.s…" 12 minutes ago Exited (0) 43 seconds ago mysql_db
588f4f1ca028 nginx "nginx -g 'daemon of…" 14 minutes ago Exited (0) 45 seconds ago nginx_web
PS C:\Users\MOHI\code> docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
PS C:\Users\MOHI\code> docker container rm httpd_web mysql_db nginx_web
httpd_web
mysql_db
nginx_web
PS C:\Users\MOHI\code> docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
PS C:\Users\MOHI\code> docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
PS C:\Users\MOHI\code> docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
httpd latest d3017f59d5e2 7 days ago 165MB
nginx latest 540a289bab6c 2 weeks ago 126MB
mysql latest c8ee894bd2bd 3 weeks ago 456MB
hello-world latest fce289e99eb9 10 months ago 1.84kB
nginx:
docker container run --publish 80:80 -d --name nginx_web nginx
mysql:
docker container run --publish 3306:3306 -d -e MYSQL_RANDOM_ROOT_PASSWORD=yes --name mysql_db mysql
httpd:
docker container run --publish 8080:80 -d --name httpd_web httpd
PS C:\Users\MOHI\code> docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
PS C:\Users\MOHI\code> docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
PS C:\Users\MOHI\code> docker container run --publish 80:80 -d --name nginx_web nginx
588f4f1ca028e6cd80a952a7ecd456093f52d10c22c2444d61d56fe0704fdf6f
PS C:\Users\MOHI\code> docker container run --publish 3306:3306 -d --env MYSQL_RANDOM_ROOT_PASSWORD=yes --name mysql_db mysql
Unable to find image 'mysql:latest' locally
latest: Pulling from library/mysql
80369df48736: Pull complete
e8f52315cb10: Pull complete
cf2189b391fc: Pull complete
cc98f645c682: Pull complete
27a27ac83f74: Pull complete
fa1f04453414: Pull complete
d45bf7d22d33: Pull complete
3dbac26e409c: Pull complete
9017140fb8c1: Pull complete
b76dda2673ae: Pull complete
bea9eb46d12a: Pull complete
e1f050a38d0f: Pull complete
Digest: sha256:7345ce4ce6f0c1771d01fa333b8edb2c606ca59d385f69575f8e3e2ec6695eee
Status: Downloaded newer image for mysql:latest
714f6bc54651d4d46efa084fd4b69c0cdafcbaea4ed0dd2d4593640f4200a9e9
PS C:\Users\MOHI\code> docker container run --publish 8080:80 -d --name httpd_web httpd
Unable to find image 'httpd:latest' locally
latest: Pulling from library/httpd
8d691f585fa8: Already exists
8eb779d8bd44: Pull complete
574add29ec5c: Pull complete
30d7fa9ec230: Pull complete
ede292f2b031: Pull complete
Digest: sha256:35fcab73dc9ae55db5c4ac33f5e0c7e76b7735aaddb628366bab04db6f8ae96e
Status: Downloaded newer image for httpd:latest
80acd2549abb38b95b1382b58ba768579b113a50c640be91a67292063ff987bc
PS C:\Users\MOHI\code> docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
80acd2549abb httpd "httpd-foreground" 54 seconds ago Up 47 seconds 0.0.0.0:8080->80/tcp httpd_web
714f6bc54651 mysql "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql_db
588f4f1ca028 nginx "nginx -g 'daemon of…" 4 minutes ago Up 3 minutes 0.0.0.0:80->80/tcp nginx_web
PS C:\Users\MOHI\code> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
80acd2549abb httpd "httpd-foreground" 6 minutes ago Up 6 minutes 0.0.0.0:8080->80/tcp httpd_web
714f6bc54651 mysql "docker-entrypoint.s…" 7 minutes ago Up 7 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql_db
588f4f1ca028 nginx "nginx -g 'daemon of…" 9 minutes ago Up 9 minutes 0.0.0.0:80->80/tcp nginx_web
PS C:\Users\MOHI\code> docker container stop httpd_web mysql_db nginx_web
httpd_web
mysql_db
nginx_web
PS C:\Users\MOHI\code> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
PS C:\Users\MOHI\code> docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
80acd2549abb httpd "httpd-foreground" 11 minutes ago Exited (0) 44 seconds ago httpd_web
714f6bc54651 mysql "docker-entrypoint.s…" 12 minutes ago Exited (0) 43 seconds ago mysql_db
588f4f1ca028 nginx "nginx -g 'daemon of…" 14 minutes ago Exited (0) 45 seconds ago nginx_web
PS C:\Users\MOHI\code> docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
PS C:\Users\MOHI\code> docker container rm httpd_web mysql_db nginx_web
httpd_web
mysql_db
nginx_web
PS C:\Users\MOHI\code> docker container ls -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
PS C:\Users\MOHI\code> docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
PS C:\Users\MOHI\code> docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
httpd latest d3017f59d5e2 7 days ago 165MB
nginx latest 540a289bab6c 2 weeks ago 126MB
mysql latest c8ee894bd2bd 3 weeks ago 456MB
hello-world latest fce289e99eb9 10 months ago 1.84kB
No comments:
Post a Comment