Docker
Image vs Container
- container is a running env for image
- it provides:
- application image
- postgres, redis
- file system (virtual)
- env configs
- application image
- it has port to connect to the application that runs inside the container
- for example: 5000
- it provides:
Basic commands
docker pull
|
|
- it pulls an image from the registry (by default: Docker Hub)
docker images
|
|
- returns list of downloaded/available images on your machine
docker run
|
|
- it runs/start the image in the container
flags
- “-d” –> runs the image in the container in detached mode (smth like as a daemon), it also returns an id of started container
docker ps
|
|
- returns list of all running containers
- the list contains ids of running containers
- these ids could be used in other commands like
docker stop <id>
ordocker start <id>
- these ids could be used in other commands like
flags
- “-a” –> returns list of running and stopped containers
docker stop
|
|
- stops the container with id = <container_id>
docker start
|
|
- start the container with id = <container_id>