Percona-Lab / mongodb_consistent_backup

A tool for performing consistent backups of MongoDB Clusters or Replica Sets
https://www.percona.com
Apache License 2.0
276 stars 81 forks source link

docker install problem #288

Open chuangtim opened 5 years ago

chuangtim commented 5 years ago

Hi.I install it from docker hub and execute the following command with root

docker run -it \ -v "/data/mongobackup/conf:/conf:Z" \ -v "/data/mongobackup/data:/var/lib/mongodb-consistent-backup:Z" \ -v "/data/mongobackup/logs:/var/log/mongodb-consistent-backup:Z" \ perconalab/mongodb_consistent_backup:latest --config=/conf/mongodb-consistent-backup.conf

The error is as follows

Traceback (most recent call last): File ".bootstrap/_pex/pex.py", line 349, in execute File ".bootstrap/_pex/pex.py", line 90, in _activate File ".bootstrap/_pex/environment.py", line 151, in activate File ".bootstrap/_pex/environment.py", line 199, in _activate File ".bootstrap/_pex/environment.py", line 140, in update_candidate_distributions File ".bootstrap/_pex/environment.py", line 111, in load_internal_cache File ".bootstrap/_pex/environment.py", line 98, in write_zipped_internal_cache File ".bootstrap/_pex/util.py", line 178, in cache_distribution File ".bootstrap/_pex/common.py", line 141, in safe_open File ".bootstrap/_pex/common.py", line 129, in safe_mkdir File "/usr/lib64/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/usr/lib64/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/usr/lib64/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/usr/lib64/python2.7/os.py", line 150, in makedirs makedirs(head, mode) File "/usr/lib64/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 13] Permission denied: '/var/lib/mongodb-consistent-backup/.pex'

Thanks chuangtim

timvaillancourt commented 5 years ago

Hi @chuangtim, try running this as the user that owns /data/mongobackup (see --user flag).

I believe /data/mongobackup is owned as a different UID than the tool expects:

docker run -it --user=$(id -u)
-v "/data/mongobackup/conf:/conf:Z" 
-v "/data/mongobackup/data:/var/lib/mongodb-consistent-backup:Z" 
-v "/data/mongobackup/logs:/var/log/mongodb-consistent-backup:Z" 
perconalab/mongodb_consistent_backup:latest --config=/conf/mongodb-consistent-backup.conf

You could also 'chown' /data/mongobackup to match the default UID the docker container runs as (probably 1000).