Running MCP Services with Docker via MCPO (DooD Strategy) #86
zhanghao-njmu
started this conversation in
Ideas
Replies: 3 comments
-
|
Hello, I also used docker compose to integrate the MCPO configuration, and the API/docs page appeared and was configured to openwebui. However, when using tools in openwebui, I encounter 401 or 404 errors. What could be the reason? I would like to ask for your experience Here is the discussion post I made. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
very nice. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Can we host the MCPO and MCP Server as 2 separate services in cloud and connect ? any pointers? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Running MCP Services with Docker via MCPO (DooD Strategy)
Due to limitations where some MCP services cannot be installed using
uvxornpx, or for scenarios requiring more secure isolation, it's beneficial to run these services via Docker. This guide outlines an updated Docker configuration using the Docker outside of Docker (DooD) strategy. This allows all MCP services, including those running in their own Docker containers, to be managed centrally by the mainmcpoinstance.The setup involves these main steps:
1. Create a New Docker Image with Docker CLI
Build a custom Docker image based on the official
mcpoimage, but with the Docker CLI installed. This enables themcpocontainer to executedockercommands.Dockerfile:Build this image:
(Make sure the Dockerfile is in the current directory when running the build command)
2. Mount the Host's Docker Socket in
docker-compose.ymlModify the
docker-compose.ymlfile to mount the host machine's Docker socket (/var/run/docker.sock) into themcpocontainer. This allows the Docker CLI inside the container to communicate with the Docker daemon running on the host.docker-compose.yml:Note: Ensure the user running the
mcpocontainer (or the Docker daemon itself) has the necessary permissions to access/var/run/docker.sockon the host. Often, this involves adding the user to thedockergroup.3. Configure Services in
config.jsonUpdate the
mcpoconfiguration file (config.json) to define how each MCP service should be launched. For services intended to run via Docker, set thecommandfield to"docker"and specify the Docker command arguments in theargsarray.config.json:{ "mcpServers": { "memory": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-memory"], "env": { "MEMORY_FILE_PATH": "/mcpo_data/memory/memory.json" } }, "time": { // --- Example: Run the 'time' service using Docker --- "command": "docker", "args": [ "run", // Docker command "-i", // Keep STDIN open even if not attached "--rm", // Automatically remove the container when it exits "--network", // Note: Networking between mcpo and Docker-run services needs consideration. "mcpo-network", // They might need to be on the same Docker network "mcp/time:latest", // The Docker image for the time service "--local-timezone=Asia/Shanghai" // Arguments passed to the service inside the container ] }, "fetch": { "command": "uvx", "args": ["mcp-server-fetch"] }, "sequential-thinking": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"] }, "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem","/mcpo_data/filesystem"] }, "quickchart-server": { "command": "npx", "args": ["-y","@gongrzhe/quickchart-mcp-server"] } } }4. Run the Setup
You have two primary ways to run this configuration:
Option A: Using Docker Compose Directly
Navigate to the directory containing your
docker-compose.ymlandDockerfile(or where you built the image) and run:--build: Rebuilds themcpo-with-dockerimage if theDockerfilehas changed.-d: Runs the containers in detached mode (in the background).Option B: Creating a Systemd Service
For automatic startup on boot and easier management, create a systemd service file.
Create the service file:
Add the following content:
Important: Replace
/path/to/your/mcpo/docker/setupwith the actual path to the directory containing yourdocker-compose.yml,config.json, etc.Enable and start the service:
With this setup, your
mcpocontainer can now launch and manage other MCP services, whether they run directly vianpx/uvxwithin themcpocontainer or are launched as separate Docker containers using the host's Docker daemon. Importantly, all MCP services managed throughmcpothis way benefit from centralized control and features like automatically generated interactive documentation.Beta Was this translation helpful? Give feedback.
All reactions