docker Flashcards
To turn and image into a container and enter its shell, type
docker run -it –name container-name image-name
To list all live running containers, type
docker ps
To exit a docker container’s shell without shutting it down, type
control P Q
A docker container is basically
a daemon thats running an image. Treat it like its own computer.
To enter the shell of a particular container, type
docker attach container-name
To shut down a container from inside it’s terminal, type
exit
To see all your downloaded docker images, type
docker images
To delete an image, type
docker rmi -f image-name
To delete a container, type
docker rm -f container-name
Am image is
all the code of the OS, the environment dependencies, and your app code
To create a new image, you need to
create a Dockerfile
The FROM section in the Dockerfile defines
which base image you will copy from dockerhub.
The EXPOSE section in the Dockerfile defines
the port that your container will be allowed listen to.
Otherwise it will ignore
To build a docker image based on your application code, and the Dockerfile, type
docker build -t my-image-name .
this is if my files are local in . and my .Dockerfile is in .
To pass requests from port 8000 on my computer to port 8000 in my computer, type
docker run -p 8000:8000 image-name