Journal
Raw Notes
Docker
- Containers share kernals
- Cant run windows on a Linux host via Docker due to kernal
- Docker Commands
- Commands
- docker ps β Shows all running containers
- docker ps -aβ Shows all running and stopped containers
- docker stop <container name or id>
- docker rm β Removes a container permanently but keeps the image
- docker images Show all docker images
- docker rmi <image name> remove docker image
- docker pull <image name> pulls the docker image from the hub
- docker run ubuntu sleep 5 β runs a container and gives it the command to sleep for 5 seconds
- docker exec <container name> <command> β will make a currently running container execute a command
- Attached vs Detached
- Attached means your console is now the console of the container
- Detached means its running self contained and your console is your underlining console.
- docker run β Will make you default attached
- docker run -d β will let you run detached
- docker attach <container id>β Allows you to attach to a currently running container.
- Command
- docker run -d --name webapp nginx:1.14-alpine β Run a detached container based on the nginx alpine container and name it webapp