Docker information
Updating Docker Compose images:
sudo docker compose down
sudo docker compose pull
sudo docker compose up -d
If you forget-d
then you cannot run Docker detached which causes you not being able to logout. Just donĀ“t forget-d
.
Updating Docker image with the Docker CLI
docker pull IMAGENAME:TAG
docker stop CONTAINER-NAME
docker rm CONTAINER-NAME
docker run -d --restart=always -p PORT:PORT -v path/to/app/data -name CONTAINER-NAME IMAGE
When inspecting the Docker run command you notice similarities with a Docker Compose file:
- -d -> detached mode
- --restart=always -> is the restart policy
- -p -> stands for the ports needs to be used external and internal
- -v -> this stands for volume to set Docker volumes
- -name -> is the name of the servive
- IMAGE -> this is the last part where you define which image you are going to use