brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Duplicate/Edit in Portainer replaces the container, it does not edit it

Portainer
~/tips/tip-portainer-duplicate-edit-container

Deploy the container → Replace

Explains that editing a container in Portainer builds a new one and what gets lost on the way.

Docker can’t change most settings of a running container. Ports, volumes, environment variables, the network: they’re fixed once the container exists. Portainer hides that limit behind one button, and it helps to know what the button really does.

Open Containers, pick the container and click Duplicate/Edit. You get the full create form, filled in with the current settings. Change what you need and click:

Deploy the container  →  Replace

Portainer’s docs say it plainly: editing a container effectively creates a new container with the updated settings and replaces the old one. Keep the same name and you get the replace prompt. Type a new name and you get a second container next to the first, which is the duplicate part. That second route is nice for a quick test, say the same image with one extra environment variable on another host port.

The catch is everything that lived only inside the old container. Data in a named volume or a bind mount survives, because the new container mounts the same place. Files written to the container’s own filesystem do not, so anything an app stored outside its volumes is gone after the replace. I’d check the volume mappings in the Advanced container settings section before clicking Replace, and on a container I care about I’d make sure its data really sits in a volume first.

One more thing I’d keep in mind: if the container belongs to a stack or a compose project, edit the compose file instead. A change made through Duplicate/Edit isn’t written back to it, so the next redeploy of the stack puts the old settings right back.

Further reading: Portainer docs: Edit or duplicate a container, Portainer docs: Advanced container settings

More Portainer tips Choose Polling in a Portainer GitOps update when your Git host can't reach Portainer Put Portainer environments in groups and give users access to a whole group Portainer's Edge Agent checks in every 5 seconds, and you can change that docker run -d -p 9001:9001 --name portainer_agent --restart=always \ Public IP: 192.168.1.20 All Portainer tips (28) All topics

Link