Custom Docker Compose MCPO

(Guide Work in Progress) Running Ubuntu on my GPD WIN 5

FROM node:24-alpine3.22

# `apk add go` is not yet good, it installs `go version go1.24.13 linux/arm64` at this time of writing, but need higher version to make Docker MCP Toolkit work with `make` 
# go.mod requires go >= 1.25.5
RUN apk add --update --no-cache curl wget python3 docker docker-compose make bash git

# Copy the script to get the latest golang amd64
COPY build/get-latest-golang-amd64.sh /tmp/get-latest-golang-amd64.sh
RUN chmod +x /tmp/get-latest-golang-amd64.sh
RUN /tmp/get-latest-golang-amd64.sh
RUN rm /tmp/get-latest-golang-amd64.sh
ENV PATH="$PATH:/usr/local/go/bin"
RUN go version

# Copy the script to build the docker mcp toolkit
COPY build/build-docker-mcp-toolkit.sh /tmp/build-docker-mcp-toolkit.sh
RUN chmod +x /tmp/build-docker-mcp-toolkit.sh
RUN /tmp/build-docker-mcp-toolkit.sh
RUN rm /tmp/build-docker-mcp-toolkit.sh

# Install `uv`
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:$PATH"

# Copy `mcpo` config
COPY data/config.json /data/config.json

CMD ["uvx", "mcpo", "--port", "8000", "--config", "/data/config.json"]
File: Dockerfile

services:
  mcpo:
    build: .
    restart: unless-stopped
    # ports:
    #   - "8000:8000"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock  # REQUIRED: For docker mcp inside mcpo
      - /root/.docker/mcp:/root/.docker/mcp:ro  # REQUIRED: Toolkit profiles/servers
File: docker-compose.yml
networks:
  cloudflared:
    external: true

services:
  mcpo:
    networks:
      - cloudflared
(Optional) File: docker-compose.override.yml
#!/bin/sh
ORIGIN_URL="https://go.dev"
LATEST_URL=$(wget -qO- https://go.dev/dl/ | grep -oE 'href="[^"]*linux-amd64\.tar\.gz"' | cut -d'"' -f2 | head -1)
wget -O /tmp/go.tar.gz "$ORIGIN_URL/$LATEST_URL"
rm -rf /usr/local/go
tar -C /usr/local -xzf /tmp/go.tar.gz
rm /tmp/go.tar.gz
export PATH=$PATH:/usr/local/go/bin
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile
go version
File: get-latest-golang-amd64.sh
#!/bin/sh
# Clone the repository
cd /tmp
git clone --depth 1 https://github.com/docker/mcp-gateway.git
cd mcp-gateway
mkdir -p "$HOME/.docker/cli-plugins/"
# Build and install the plugin
make docker-mcp

docker mcp --help
rm -rf /tmp/mcp-gateway
File: build-docker-mcp-toolkit.sh