alasarr
alasarr

Reputation: 1605

How to add --restart='always' to container already created

I've created a container and I've forgot to set the --restart='always' when I created it.

Is it possible to modify this option for a container already created? I know I can created a new one but that would be useful because it had happened to me several times...

Upvotes: 1

Views: 178

Answers (2)

av_bb
av_bb

Reputation: 23

this works for me on docker version 19.03.8:

docker update --restart=always 64aa

"64aa" are the first digits of my container id - Find that with docker container ls --all

Upvotes: 0

ISanych
ISanych

Reputation: 22680

docker update now allows to change configuration of running container, including restart policy - https://docs.docker.com/engine/reference/commandline/update/

Upvotes: 2

Related Questions