What is a difference between Docker i Docker compose?
Docker has very rich syntax of its commands. Plenty of parameters, that we can pass, makes it very flexible tool but also a bit complicated. To make it simpler and not require passing a lot of stuff in automation scripts, that builds and runs containers, a kind of wrapper was made (docker compose). It use YAML file to define a list of necessary parameters and its values.
Docker
- build an image:
docker build -f your.Dockerfile --no-cache
- run the container:
docker run -e-it image_id
Docker compose
- build an image:
docker compose -f your_compose.yaml build --no-cache
- build an image and gathering output:
docker compose -f your_compose.yaml build --no-cache > build.log 2>&1
- run the container:
docker compose -f your_compose.yaml up --build