How to run two "Independent" Cockpit containers in Docker


Hi, I’m new to Cockpit and a total noob at Docker:no_mouth: I originally had some difficulty setting up Cockpit on Ubuntu so I decided to go the Docker route… this worked great!

Now I’m trying to run two instances of Cockpit for two separate domains. I used reverse proxy in my NGINX conf files to map the domains to two different ports on localhost (3000,5000):

upstream ap1-api {

upstream ap2-api {

Then I spun up two Docker containers from the same Cockpit image:

docker run -d --name app1-api -p agentejo/cockpit -D FOREGROUND

docker run -d --name app2-api -p agentejo/cockpit -D FOREGROUND

I was able to get Cockpit running on both domains, but it looks they are sharing the same data… adding to a collection on one domain also adds it in the other.

I thought maybe my mistake was spinning up a container from the same image in docker. So naturally I did a docker image save and then imported that image (ending up with two differently named Cockpit images), but… when I start up the two containers they are both still sharing the same data.

If anyone could point me in the right direction that would be great.



in your example seems that you have the same port (3000) in your upstreams!

in such case a better approach (at least for local development) would be to use traefik to forward requests to your containers (no need to use nginx or expose ports in the cockpit containers)


Thanks for getting back to me, and sorry for the copy/paste typo. I was indeed running two different ports 3000,5000 (I’ve edited my post).

Also to clarify: I don’t believe I was exposing the ports in the Cockpit containers, what I intended to do was reverse proxy my api subdomain to the Docker container (got the idea from this Digital Ocean tutorial:

As for the use case, I was testing a production environment that I hoped would work for multiple very small web apps. I have a Linode server running Ubuntu + NGINX. I want my web-apps to consume the Cockpit API (which would be running on the “api” subdomain of the top level domain, ex:

Everything works as expected (proxying is fine)… it just seems like the two Cockpit Docker containers are sharing data.

Upon further Googling, it seems like there might be something to do with “Volumes” in Docker that could allow me to use the same agentejo/cockpit image to start both containers, but just have data in separate volumes?

Does this sound like I’m on the right track? If so then my idea is right, I just have no clue how to set this up. Do I modify something in the agentejo/cockpit image?

Thanks again for the help!


Ok, if it’s for production you are doing it right (I’m doing the same, nginx as reverse proxy and docker containers), let me try to find some time and share a docker-composer that works for that case


Are you sure that you’re not ending up in the same cockpit instance for both virtual hosts?

I had no trouble whatsoever with multiple docker compose running on the same vps.


Hi and thanks for taking the time to respond! I very well could be ending up in the same Cockpit instance on both virtual hosts. My problem is I don’t exactly understand why. (I’m brand new to Docker)

My original post shows the Docker run commands that I’m executing which created two differently named containers from the agentejo/cockpit image. It exposes each on a different port.

My aim was to end up with two containers/instances of Cockpit (if container & instance are synonymous). I assumed this was possible to do from a single Cockpit image. Is this my mistake?

Based on your response I wonder if my problem has something to do with using “run” vs “compose.” I don’t understand the difference.

The Cockpit documentation shows using the “run” command so that’s why I did it that way.