ドッカーのドキュメントの例に従ってデータを読み取ることができません。おそらく、私のドッカーの設定に何か問題がありますか?バインドされたパーティションからデータを読み取ることができません。
これに応じてコンテナを作成します。https://docs.docker.com/engine/tutorials/dockervolumes/#mount-a-host-file-as-a-data-volume
docker run --rm -it -v ~/.bash_history:/root/.bash_history ubuntu /bin/bash
私はコンテナからの歴史を見しようとすると、私は「アクセス許可拒否エラー」を取得:
[email protected]:/# history
1 ls -la ~/
2 history
[email protected]:/# cat ~/.bash_history
cat: /root/.bash_history: Permission denied
です.bash_historyファイルの所有権に何か間違っていますか?
[email protected]:/# ls -la ~/
total 60
drwx------ 2 root root 4096 Mar 8 21:14 .
drwxr-xr-x 35 root root 4096 Mar 8 21:14 ..
-rw------- 1 nobody nogroup 42996 Mar 8 21:06 .bash_history
-rw-r--r-- 1 root root 3106 Oct 22 2015 .bashrc
-rw-r--r-- 1 root root 148 Aug 17 2015 .profile
4.4および4.10カーネルはどちらも同じ結果を示します。
私はLinux Mint 18.1を使用しています。ここではいくつかのシステム情報は、次のとおりです。
$ uname -a
Linux a 4.4.0-65-generiC#86-Ubuntu SMP Thu Feb 23 17:49:58 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ docker --version
Docker version 17.03.0-ce, build 3a232c8
$ docker info
Containers: 39
Running: 1
Paused: 0
Stopped: 38
Images: 269
Server Version: 17.03.0-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/296608.296608/aufs
Backing Filesystem: extfs
Dirs: 395
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 977c511eda0925a723debdc94d09459af49d082a
runc version: a01dafd48bc1c7cc12bdb01206f9fea7dd6feb70
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
userns
Kernel Version: 4.4.0-65-generic
Operating System: Linux Mint 18.1
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.55 GiB
Name: a-dell
ID: IEJP:6N34:GFBS:VIOM:HDBW:NVOF:BH3E:HZFO:3SOE:AACN:VZCV:FSWZ
Docker Root Dir: /var/lib/docker/296608.296608
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
UPDATE
私はこの問題は、ファイルのアクセス権/属性であることがわかります。私が.bash_historyの属性を変更して誰もが読めるようにすると、ドッカーのコンテナはそれにアクセスできます。実行しているコンテナにファイルのアクセス権を共有する方法はありますか?
問題はファイルのアクセス権/属性にあることがわかります。 .bash_historyの属性を変更してみんなのために読むことができるようにすると、ドッカーはそれにアクセスできません。実行しているコンテナに自分のアクセス権を共有する方法を知っていますか? – anddr