Docker volume 目录权限问题

2018-05-24  本文已影响0人  just_a_name

将宿主机中的path1 (owner是root)挂载到容器path2(容器内的用户gitlab)中,gitlab用户无法读取或写入新挂载的目录path1,需要先执行
sudo chcon -Rt svirt_sandbox_file_t /srv/docker/gitlab/gitlab
改变目录类型
mkdir -p /srv/docker/gitlab/gitlab
sudo chcon -Rt svirt_sandbox_file_t /srv/docker/gitlab/gitlab
Volumes can be mounted in docker by specifying the -v option in the docker run command.

docker run --name gitlab -d
--volume /srv/docker/gitlab/gitlab:/home/git/data
sameersbn/gitlab:10.7.4

上一篇 下一篇

猜你喜欢

热点阅读