diff options
author | Pedro Alvarez Piedehierro <palvarez89@gmail.com> | 2017-07-17 23:43:50 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-07-19 21:42:27 +0900 |
commit | 96fca9b272fe8ecd3443307fc8d5beb3b24cadcf (patch) | |
tree | 612f0c684882c6d920809eaceea9ffc48e7cc305 | |
parent | a19b98e95aa0f4402206a417347a8430c375b478 (diff) | |
download | buildstream-96fca9b272fe8ecd3443307fc8d5beb3b24cadcf.tar.gz |
docs: Fix Docker instructions
Suggest the user to mount /etc/passwd inside the container to fix `bzr`
command.
The command `bzr` fails if the uid of the user using it doesn't exist,
giving, for example, the following back trace when running `bzr init`:
File "/usr/lib64/python2.7/site-packages/bzrlib/lockdir.py", line 238, in _attempt_lock
tmpname = self._create_pending_dir()
File "/usr/lib64/python2.7/site-packages/bzrlib/lockdir.py", line 335, in _create_pending_dir
info = LockHeldInfo.for_this_process(self.extra_holder_info)
File "/usr/lib64/python2.7/site-packages/bzrlib/lockdir.py", line 779, in for_this_process
user=get_username_for_lock_info(),
File "/usr/lib64/python2.7/site-packages/bzrlib/lockdir.py", line 863, in get_username_for_lock_info
return osutils.getuser_unicode()
File "/usr/lib64/python2.7/site-packages/bzrlib/osutils.py", line 356, in _posix_getuser_unicode
name = getpass.getuser()
File "/usr/lib64/python2.7/getpass.py", line 158, in getuser
return pwd.getpwuid(os.getuid())[0]
KeyError: 'getpwuid(): uid not found: 1000'
To fix this there were 2 possible solutions:
- To run everything as rooat (or as another user) in the container. We
will not need to set the uid to use, making the instructions simpler.
The main problem is that the files stored in the host will probably
have a different owner, and the user will have problems with file
permissions.
- To ensure the uid of the current user also exists inside the
container.
-rw-r--r-- | doc/source/install.rst | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/doc/source/install.rst b/doc/source/install.rst index 7d18cdeed..392ed7d42 100644 --- a/doc/source/install.rst +++ b/doc/source/install.rst @@ -195,7 +195,8 @@ following command: :: - docker run -it -u $UID:$EUID -v `pwd`:/bst-src:rw \ + docker run -it -u $UID:$EUID -v /etc/passwd:/etc/passwd \ + -v `pwd`:/bst-src:rw \ --privileged -w /bst-src buildstream \ python3 setup.py test @@ -204,6 +205,8 @@ Options explained: - ``-it``: Interactive shell and TTY support. - ``-u $UID:$EUID``: Use $UID as user-id and $EUID as group-id when running the container. +- ``-v /etc/passwd:/etc/passwd``: Mount passwd file in container to ensure + the user with uid $UID exists (Needed for bzr support). - ``-v $(pwd):/bst-src:rw``: Mount BuildStream source tree in ``/bst-src`` with RW permissions. - ``--privileged``: To give extra privileges to the container (Needed @@ -222,7 +225,7 @@ Run the following command to run a bash session inside the container: :: - docker run -it -u $UID:$EUID \ + docker run -it -u $UID:$EUID -v /etc/passwd:/etc/passwd \ -v /path/to/buildstream/workspace:/src:rw \ -v /path/to/buildstream/tmp:/buildstream:rw \ buildstream bash @@ -232,6 +235,8 @@ Options: - ``-it``: Interactive shell and TTY support. - ``-u $UID:$EUID``: Use $UID as user-id and $EUID as group-id when running the container. +- ``-v /etc/passwd:/etc/passwd``: Mount passwd file in container to ensure + the user with uid $UID exists (Needed for bzr support). - ``-v /path/to/buildstream/workspace:/src:rw``: Mount your workspace in ``/src`` inside the container. - ``-v /path/to/buildstream/tmp:/buildstream:rw``: Mount a temporary folder |