Skip to content
This repository has been archived by the owner on Jun 22, 2018. It is now read-only.

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

Open
sadovnikov opened this issue May 4, 2016 · 2 comments
Open

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

sadovnikov opened this issue May 4, 2016 · 2 comments

Comments

@sadovnikov
Copy link
Contributor

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 sadovnikov added the bug label May 4, 2016
@sadovnikov
Copy link
Contributor Author

Possibly, has the same cause as #426

@sashkachan
Copy link

sashkachan commented May 20, 2016

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants