docker-rerun
is a small utility script that makes it easy to re-run docker
containers using the same arguments you used previously.
Want to update to a newer image, or add a missing port publication? docker-rerun’s got you covered.
In the most basic usage, you pass in a container name and it will be stopped, deleted and recreated:
$ ./docker-rerun apache
You can also pass additional arguments to modify aspects of the container when it’s rerun. For example, to change the image:
$ ./docker-rerun --image nginx:latest webserver
To check what exactly is going to be performed beforehand, use the --dry-run option:
$ ./docker-rerun --dry-run apache
docker stop apache
docker rm apache
docker run --name=apache -p=80:80/tcp --restart=always apache:latest
At present docker-rerun supports copying a number of commonly used arguments:
If a container uses an argument that’s not supported yet, it will be silently dropped when rerunning.
The following arguments can be used when executing docker-rerun
to modify
the resulting container:
--image <image>
- changes the image that will be used. You can specify
tags (name:tag
) or digests (name@digest
) as with docker run
.-p <port>
or --port <port>
- expose additional ports. Same format
as docker run
’s -p
option.Many other command line arguments:
More options to allow mutating the container config when rerunning.