Docker
- If I understand it correctly, you create docker images and then run them in containers.
- Containers to launch applications, if you want to control the dev environment.
- For my applications it was probably not required, we did it anyhow
- You can use docker compose if you want to run boot 2 applications simultaneously.
Imagesβ
Create an imageβ
- locally
docker build -t image-name .
Check imagesβ
docker images
Delete particular imageβ
docker rmi <imageid>
Delete all local imagesβ
docker rmi -f $(docker images -aq)
Prune dangling imagesβ
docker image prune -f
To check if docker is runningβ
systemctl is-active docker
Containersβ
To run a containerβ
docker run -p 3000:3000 image-name
To get running docker containersβ
docker ps
Stop & Remove the Existing Containerβ
- Since environment variables are loaded when the container starts, you need to restart your container.
docker stop container-name
docker rm container-name
- If youβre unsure about the container name, check running containers with:
To print env variablesβ
docker exec -it goals env
To get the logsβ
docker logs --tail=50 goals