-1

Dockerfile

https://github.com/monero-project/monero/blob/master/Dockerfile

当我执行以下命令时

docker run -it --restart always --name monero -v /srv/monero/chain:/home/monero/.bitmonero -v /srv/monero/wallet:/wallet --privileged=true monero

主要例外!boost::filesystem::create_directory:权限被拒绝:“/home/monero/.bitmonero/lmdb”

接下来,我添加了 -u root:root

docker run -it -u root:root --restart always --name monero -v /srv/monero/chain:/home/monero/.bitmonero -v /srv/monero/wallet:/wallet --privileged=true monero

成功的

但是/srv/monero/chain目录中没有文件

我认为这是我与 docker 的问题,我是 docker 新手,与门罗币无关

附加信息

root@HEY13233121:~# docker run -it -d -u root --restart always --name monero --network net-1 --network-alias monero -v /srv/monero/chain:/home/monero/.bitmonero -v /srv/monero/wallet:/wallet -v /etc/localtime:/etc/localtime:ro --privileged=true monero
8e0a63230adf3ead036360e3662b00c95085776791eebab44d87a8123fff09d8
root@HEY13233121:~# docker exec -it monero bash
root@8e0a63230adf:/# ll
total 80
drwxr-xr-x   1 root root 4096 Mar 26 05:24 ./
drwxr-xr-x   1 root root 4096 Mar 26 05:24 ../
-rwxr-xr-x   1 root root    0 Mar 26 05:24 .dockerenv*
drwxr-xr-x   2 root root 4096 Jan 14 10:45 bin/
drwxr-xr-x   2 root root 4096 Apr 12  2016 boot/
drwxr-xr-x  13 root root 3760 Mar 26 05:24 dev/
drwxr-xr-x   1 root root 4096 Mar 26 05:24 etc/
drwxr-xr-x   1 root root 4096 Mar 25 23:46 home/
drwxr-xr-x   1 root root 4096 Sep 13  2015 lib/
drwxr-xr-x   2 root root 4096 Jan 14 10:44 lib64/
drwxr-xr-x   2 root root 4096 Jan 14 10:43 media/
drwxr-xr-x   2 root root 4096 Jan 14 10:43 mnt/
drwxr-xr-x   2 root root 4096 Jan 14 10:43 opt/
dr-xr-xr-x 250 root root    0 Mar 26 05:24 proc/
drwx------   1 root root 4096 Mar 26 05:24 root/
drwxr-xr-x   1 root root 4096 Jan 14 10:44 run/
drwxr-xr-x   1 root root 4096 Mar 25 18:33 sbin/
drwxr-xr-x   2 root root 4096 Jan 14 10:43 srv/
dr-xr-xr-x  13 root root    0 Mar 25 23:58 sys/
drwxrwxrwt   1 root root 4096 Mar 25 23:46 tmp/
drwxr-xr-x   1 root root 4096 Jan 14 10:43 usr/
drwxr-xr-x   1 root root 4096 Jan 14 10:45 var/
drwxr-xr-x   2 root root 4096 Mar 26 01:16 wallet/
root@8e0a63230adf:/# cd home/
root@8e0a63230adf:/home# ll
total 12
drwxr-xr-x 1 root   root   4096 Mar 25 23:46 ./
drwxr-xr-x 1 root   root   4096 Mar 26 05:24 ../
drwxr-xr-x 3 monero monero 4096 Mar 25 23:46 monero/
root@8e0a63230adf:/home# cd monero/
root@8e0a63230adf:/home/monero# ll
total 12
drwxr-xr-x 3 monero monero 4096 Mar 25 23:46 ./
drwxr-xr-x 1 root   root   4096 Mar 25 23:46 ../
drwxr-xr-x 2 root   root   4096 Mar 26 01:16 .bitmonero/
root@8e0a63230adf:/home/monero# cd .bitmonero/
root@8e0a63230adf:/home/monero/.bitmonero# ll
total 8
drwxr-xr-x 2 root   root   4096 Mar 26 01:16 ./
drwxr-xr-x 3 monero monero 4096 Mar 25 23:46 ../

4

1 回答 1

0

第1步:

docker run -it -u root --rm -v /srv/monero/chain:/home/monero/.bitmonero -v /srv/monero/wallet:/wallet -v /etc/localtime:/etc/localtime:ro --entrypoint=/bin/chown monero -R monero:monero /home/monero/.bitmonero

第2步:

docker run -itd --restart always --name monero --network net-1 --network-alias monero -v /srv/monero/chain:/home/monero/.bitmonero -v /srv/monero/wallet:/wallet -v /etc/localtime:/etc/localtime:ro --privileged=true monero
于 2021-03-28T16:07:03.840 回答