This is useful if you’re planning to reboot your host or the Docker daemon and want a certain container to stay stopped – or automatically start – after the specific event. The four available policies let you force the container to start, make it stay stopped, or conditionally start based on the container’s previous exit code or running state.ĭocker supports changing restart policies on-the-fly. Restart policies determine whether containers should start automatically after your host reboots or the Docker daemon launches. It takes two arguments, the target container’s ID or current name, and the new name to assign: # docker rename ĭocker rename old_name new_name Changing the Restart Policy The docker rename command is used to change container names after creation. You can use names to reference containers in Docker CLI commands choosing an appropriate memorable one avoids running docker ps to find a container’s auto-assigned name or ID. When no name is supplied, the Docker daemon assigns a random one. Names are assigned via the -name flag for docker run. The simplest modification is renaming a created container. We’ll also look at what you shouldn’t change and a workaround you can use if you believe you must.
#Docker network modify how to
In this guide, we’ll show you how to use built-in Docker commands to modify selected parameters of running containers. You can update some configuration parameters dynamically though, such as the container’s name and its hardware resource limits. Docker containers are usually treated as immutable once they’ve started running.