Skip to content

Commit f10e319

Browse files
authored
Enhance Docker update instructions in documentation
Added instructions for updating Docker containers using Docker Compose and Watchtower.
1 parent 71d37d8 commit f10e319

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

programming-notes/general/docker.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,19 @@ docker compose logs
120120

121121
The basic method for updating a container is to pull a newer version of the container image, remove the container, and then start a new container using the new image version. This is one reason storing data inside volumes is important. It's the only way data can survive this process.
122122

123+
If using a compose file you can:
124+
125+
```bash
126+
docker compose pull
127+
docker compose up -d
128+
```
129+
130+
After updating, you might want to remove unsued images:
131+
132+
```bash
133+
docker image prune
134+
```
135+
123136
[Watchtower](https://containrrr.dev/watchtower) is a service for keeping containers up to date (runs inside a container). It detects whenever a new version is available and automatically replaces containers with the new version using the same settings they were created with.
124137

125138

0 commit comments

Comments
 (0)