0% found this document useful (0 votes)
71 views2 pages

Docker Basics

The document shows the steps taken to run an Nginx Docker container on a server. It starts the container with port 80 exposed and shows it is running. It then lists all containers, both running and stopped. It also lists the Docker images on the system before checking the running container again. It demonstrates removing a non-existent container, stopping a container by ID, and executing interactive bash in the running container to create and move a directory.

Uploaded by

Het Bhavin Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views2 pages

Docker Basics

The document shows the steps taken to run an Nginx Docker container on a server. It starts the container with port 80 exposed and shows it is running. It then lists all containers, both running and stopped. It also lists the Docker images on the system before checking the running container again. It demonstrates removing a non-existent container, stopping a container by ID, and executing interactive bash in the running container to create and move a directory.

Uploaded by

Het Bhavin Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

ubuntu@pwst-server:~$ sudo docker run -d -p 80:80 nginx

[sudo] password for ubuntu:


dfcb8292cf757dedaa5b79393f855cd91d006ff7538779492b7bb969e0f10da6

ubuntu@pwst-server:~$ sudo docker ps -a


CONTAINER ID IMAGE COMMAND CREATED STATUS
PORTS NAMES
dfcb8292cf75 nginx "/docker-entrypoint.…" 45 seconds ago Up 44
seconds 0.0.0.0:80->80/tcp, :::80->80/tcp wonderful_elgamal
66eef0c6e23e nginx "/docker-entrypoint.…" 6 hours ago Exited (0) 6
hours ago cool_engelbart
41ea862e04d6 nginx "/docker-entrypoint.…" 6 hours ago Exited (0) 6
hours ago admiring_shtern
6677c53374d5 nginx "/docker-entrypoint.…" 6 hours ago Exited (0) 6
hours ago elegant_ganguly
c67af67f6c88 nginx "/docker-entrypoint.…" 6 hours ago Exited (0) 6
hours ago pensive_kalam
c216d43910e8 hello-world "/hello" 8 hours ago Exited (0) 8
hours ago recursing_kapitsa

ubuntu@pwst-server:~$ sudo docker ps


CONTAINER ID IMAGE COMMAND CREATED STATUS
PORTS NAMES
dfcb8292cf75 nginx "/docker-entrypoint.…" 52 seconds ago Up 51 seconds
0.0.0.0:80->80/tcp, :::80->80/tcp wonderful_elgamal

ubuntu@pwst-server:~$ sudo docker image ls


REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest a7be6198544f 20 hours ago 142MB
hello-world latest 9c7a54a9a43c 2 weeks ago 13.3kB

ubuntu@pwst-server:~$ sudo docker images


REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest a7be6198544f 20 hours ago 142MB
hello-world latest 9c7a54a9a43c 2 weeks ago 13.3kB

ubuntu@pwst-server:~$ sudo docker ps


CONTAINER ID IMAGE COMMAND CREATED STATUS
PORTS NAMES
dfcb8292cf75 nginx "/docker-entrypoint.…" 46 minutes ago Up 46 minutes
0.0.0.0:80->80/tcp, :::80->80/tcp wonderful_elgamal

ubuntu@pwst-server:~$ sudo docker rm -f f5


f5

ubuntu@pwst-server:~$ sudo docker stop <container ID>


<container ID>

ubuntu@pwst-server:~$ sudo docker exec -it dfcb bash


root@dfcb8292cf75:/#

root@dfcb8292cf75:/# ls
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@dfcb8292cf75:/# mkdir testing


root@dfcb8292cf75:/# ls
bin boot dev docker-entrypoint.d docker-entrypoint.sh etc home lib lib64
media mnt opt proc root run sbin srv sys testing tmp usr var

root@dfcb8292cf75:/# mv testing /home


root@dfcb8292cf75:/# cd home
root@dfcb8292cf75:/home# ls
testing

You might also like