Running docker on Ubuntu: the mounted host is not writable from the container

Docker works fine on Mac for me, but I need to run the docker host inside VirtualBox (or Parallels or VMWare Fusion), because the Mac kernel does not support docker.

So, I tried to configure the docker application and layout on the Ubuntu desktop - initially, where both the docker client and the host docker are physically launched on the same system. This worked, but my running docker containers cannot write to the installed host volume.

I am using docker-compose with the following settings:

volumes:
   - ./api:/usr/src/app

So, I mount the "api" directory of the Ubuntu OS host in the docker container in / usr / src / app.

docker inspect <container ID> indicates that the volume is writable

"Destination": "/usr/src/app",
"Mode": "rw",
"RW": true

: permission denied, .

, , , SELinux CentOS/RHEL, Ubuntu 15.10, 64- , CentOS.

+4
2

uid (id -u) uid ( "" ), . :

  • UID .
  • , , , .
  • :

chmod a+rwx -R project-dir/

git , , . .

:

+8

1.7 , : Z : z:

docker run -v ./api:/usr/src/app:Z
  • : z - , 'svirt_sandbox_file_t'
  • : Z -

docker-compose v1.4.0, , :

volumes:
   - ./api:/usr/src/app:Z

, (. docker-compose).

:

SELinux - http://www.projectatomic.io/blog/2015/06/using-volumes-with-docker-can-cause-problems-with-selinux/

Docker -  https://docs.docker.com/engine/userguide/dockervolumes/#volume-labels

Docker- v1.4.0 - https://github.com/docker/compose/releases/tag/1.4.0

+10

Source: https://habr.com/ru/post/1618193/


All Articles