Docker Community Forums

Share and learn in the Docker community.

Ghost CMS on rootless docker

Issue Summary

Ubuntu 20.04 LTS server

Ghost is freezing after deploying by docker-compose on rootless docker.

from terminal:
Creating mysql … done
Starting ghost … done
Attaching to ghost … <and freezing, do nothing>

“docker logs ghost” shows nothing.

Checked config files and they seem to be ok.

To Reproduce

  1. Docker rootless
  2. /etc/docker/daemon.json
{
        "data-root": "/mnt/docker-data",
        "storage-driver": "overlay2"
    },
    { 
        "userns-remap": "nonrootdockeruser"
    },
    {
        "live-restore": true
    },
    {
        "userland-proxy": false
    },
    {
        "no-new-privileges": true
    },
  1. docker-compose file:
version: "2.4"

networks:
  web:
    ipam:
      driver: default
      config:
        - subnet: 10.1.0.0/16

services:
  caddy:
.. proxy settings

  ghost:
    container_name: ghost
    image: ghost:latest
    restart: unless-stopped  
    cap_add:
      - NET_BIND_SERVICE  #Should i use it for SMTP email?
    depends_on:
      - mysql
    environment:
      NODE_ENV: production
      url: https://example.com
    volumes:
      - ./ghostcms/content:/var/lib/ghost/content
      - ./ghostcms/config.production.json:/var/lib/ghost/config.production.json
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s
    networks:
      web:
        ipv4_address: 10.1.0.6

  mysql:
    container_name: mysql
    image: mysql:8.0
    command: --default-authentication-plugin=mysql_native_password
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: ............
      MYSQL_DATABASE: ..........
      MYSQL_USER: ............
      MYSQL_PASSWORD: ...........
      MYSQL_ROOT_HOST: 10.1.*.*
    volumes:
      - ./mysql:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s
    networks:
      web:
        ipv4_address: 10.1.0.7
  1. ghost config file
{
    "url": "https://example.com",
    "server": {
        "port": 2351,
        "host": "10.1.0.6"
    },
    "database": {
        "client": "mysql",
        "connection": {
            "host": "10.1.0.7",
            "port": 3306,
            "user": ".....",
            "password": ".....",
            "database": "..........",
            "charset": "utf8mb4"
            }
    },
    "mail": {
        "transport": "SMTP",
        "options": {
          "service": "Sendinblue",
          "host": "smtp-relay.sendinblue.com",
          "port": 587,
          "secureConnection": true,
          "auth": {
            "user": ".....................",
            "pass": "............."
          }
        }
    },
    "privacy": {
      "useUpdateCheck": false,
      "useGravatar": false
    },
    "logging": {
      "path": "/var/lib/ghost/content/logs/",
      "level": "error",
      "rotation": {
        "enabled": true,
        "count": 15,
        "period": "1d"
      },
      "transports": ["stdout", "file"]
    }
  }