Docker
This content is not available in your language yet.
Basics
Section titled “Basics”docker create [IMAGE] # Creates a container with image
docker start [CONTAINER ID]docker start -a [IMAGE] # for our purpose for now, -a to show output on console
docker run [IMAGE] # Creates a container with image, and starts it
docker ps --all # List containers
docker system prune
docker logs [CONTAINER ID]
docker stop [CONTAINER ID] # Sends SIGTERM to process in container. If container doesn't stop in 10 seconds, docker sends a KILL signal.docker kill [CONTAINER ID] # Sends SIGKILL to process in container
docker exec -it [CONTAINER ID] [COMMAND] # Execute an additional command in a containerdocker exec -it [CONTAINER ID] sh # Specific example very useful in real life, opens up a shell
docker run -it [CONTAINER ID] shDockerfile - Creating Images
Section titled “Dockerfile - Creating Images”FROM alpineRUN apk add --update redisCMD ["redis-server"]docker build . # from directory containing dockerfile