https://github.com/jdevelop/repull
A tool to restart a Docker container with a newer version of the image
https://github.com/jdevelop/repull
docker golang tools
Last synced: 5 months ago
JSON representation
A tool to restart a Docker container with a newer version of the image
- Host: GitHub
- URL: https://github.com/jdevelop/repull
- Owner: jdevelop
- Created: 2020-10-21T03:12:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-30T16:45:08.000Z (almost 5 years ago)
- Last Synced: 2024-08-10T11:02:36.880Z (almost 2 years ago)
- Topics: docker, golang, tools
- Language: Go
- Homepage:
- Size: 50.8 KB
- Stars: 25
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# repull
A tool to restart a Docker container with a newer version of an image used by the container
---
Often you may need to pull a newer version of an image to re-create an existing container,
and you don't care much about the checkpoints because the application is stateless.
The usual way of doing that is to use
```
docker pull repo/app
docker kill containerId
docker rm containerId
docker run --name xyz --link -v ... -p ... etc
```
This is quite tedious and requires to remember all the command line options that were used to start the container.
With `k8s` or `docker-compose` it is possible to solve that, but for vanilla Docker containers it could be tricky.
`repull` simplifies it to the point of `repull ...`.
It will
1. iterate over the list of passed container ids or names
2. fetch the description of the container
3. identify the image used in the container
4. lookup the information about the authentication in `~/.docker/config.json`
5. pull the new version of the image, if available for the current tag.
6. kill the existing container
7. remove the existing container
8. start the new container with the newest image available **preserving all configuration/startup options**
9. repeat for all images passed in the arguments.
## Install and Run from Github Content Repository
```
$ docker run \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $HOME/.docker/config.json:/.docker/config.json \
ghcr.io/jdevelop/repull:latest CONTAINER_NAME1 CONTAINER_NAME2 ... CONTAINER_NAMEN
```
## Install and Run from Source (requires go)
```
$ go install github.com/jdevelop/repull
$ repull -h
```
## Usage
```
./repull -h
Usage of ./repull:
-t int
timeout (seconds) (default 5)
-v verbose
```