As per PX4/PX4-Devguide#232 ...
I followed the instructions in devguide here, setting up docker in a clean Ubuntu 16.04 running on a VM (in Windows). Including post instructions to ensure I didn't have to execute docker as sudo.
I added /src dir and cloned Firmware in it. I can see that the parent above src belongs to root, and that src and below belong to my logged in user (via ls -la
)
Then I tried to run the image in our docs:
xhost +
docker run -it --privileged \
-v <src_to_local_firmware>:/src/firmware/:rw \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-e DISPLAY=:0 \
-p 14556:14556/udp \
--name=px4_ros_sim px4io/px4-dev-ros:2017-05-31 bash
This "worked". I can log in and see /src/firmware, and the contents I have cloned. When I try to run make posix_sitl_default gazebo
I get permission errors because docker can't create the build directory. The reason being that docker sets itself up as root user by default, which does not appear to have access.
If I go back to ubuntu and make access on the git tree "open" (e.g. chmod -R 7777 .
) then I can build from docker and everything works. However this is a pretty bad recommendation to give users.
I have tried to send in another user via the -u flag (e.g. my current VM host user id "1000"). This does not work (user is not found). I tried the flag with the user's name too, but got told there is a missing password file. I think the problem is that the VM does not know about any users outside of itself other than root.
Any suggestions on "right way to fix". I'm hoping for instructions that don't require a user to do anything to their machine other than run a docker command.
FYI, this is the setup script:
# Install Docker CE for Ubuntu script - for Xenial 16.04 (LTS)
## https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/
##uninstall old versions
sudo apt-get remove docker docker-engine docker.io -y
##Update the apt package index:
sudo apt-get update
##Install packages to allow apt to use a repository over HTTPS:
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
## Add Dockerโs official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
##Verify that the key fingerprint is 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.
sudo apt-key fingerprint 0EBFCD88
##We're not doing any actual verification!
## Set up stable repository
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
##Update the apt package index.
sudo apt-get update
##Install the latest version of Docker CE. Any existing installation of Docker is replaced.
sudo apt-get install docker-ce -y
# Create the docker group and add your user:
sudo groupadd docker
sudo usermod -aG docker $USER
Then restarted and verified using docker run hello-world