ContainerSolutions / minimesos

The experimentation and testing tool for Apache Mesos - NO LONGER MAINTANED!
https://www.minimesos.org
Apache License 2.0
428 stars 61 forks source link

Failures to write to host from non-root processes #427

Open sadovnikov opened 8 years ago

sadovnikov commented 8 years ago

Start minimesos cluster and install MySql using

{
  "id": "mysql",
  "env": {
    "MYSQL_ROOT_PASSWORD": "RNwULK1oySla",
    "MYSQL_USER": "wpdb",
    "MYSQL_PASSWORD": "e2AtRUUlgLel",
    "MYSQL_DATABASE": "wp"
  },
  "container": {
    "type": "DOCKER",
    "docker": {
      "network": "BRIDGE",
      "image": "mysql:5.7.12"
    },
    "volumes": [
      {
        "hostPath": "${MINIMESOS_HOST_DIR}/data/mysql",
        "containerPath": "/var/lib/mysql",
        "mode": "RW"
      }
    ]
  },
  "cpus": 1,
  "mem": 512,
  "instances": 1,
  "constraints": [
    ["hostname", "UNIQUE"]
  ]
}

Container starts, but mysql fails to create databases - unable to write to disk. To work-around this, remove ${MINIMESOS_HOST_DIR} from hostPath. /data/mysql directory will get created in docker-machine, and mysql is able to write

sadovnikov commented 8 years ago

Possibly, has the same cause as #426

sashkachan commented 8 years ago

I think it's reasonable to make it a requirement to run docker with user namespaces enabled. Then root account in a container will always map to the user who's running the container. As long as the containers run under root, writing something in mapped volumes will result in files owned by root. Only container processes run under root and root account can make changes to these files then.

Also described here #332