radarku / ardupilot-sitl-docker

Docker container for ArduPilot Software-in-the-Loop Simulator
Apache License 2.0
47 stars 30 forks source link

Docker build fails with new releases of ArduPilot #14

Open anasLearn opened 1 year ago

anasLearn commented 1 year ago

How to reproduce: Change COPTER_TAG to a new release in the docker file. For example:

ARG COPTER_TAG=Copter-4.3.6

run the command: docker build -t ardupilot .

Output:

=> ERROR [ 8/16] RUN USER=nobody Tools/environment_install/install-prereqs-ubuntu.sh -y                                                                                      0.5s 
------                                                                                                                                                                             
 > [ 8/16] RUN USER=nobody Tools/environment_install/install-prereqs-ubuntu.sh -y:                                                                                                 
#11 0.535 + '[' 0 == 0 ']'                                                                                                                                                         
#11 0.535 + echo 'Please do not run this script as root; don'\''t sudo it!'                                                                                                        
#11 0.535 + exit 1
#11 0.535 ---------- Tools/environment_install/install-prereqs-ubuntu.sh start ----------
#11 0.535 Please do not run this script as root; don't sudo it!
------
executor failed running [/bin/sh -c USER=nobody Tools/environment_install/install-prereqs-ubuntu.sh -y]: exit code: 1

Expected Output: Build succesful

jkronk commented 1 year ago

I have been running into this as well and trying to run it with a different user. Anyone got a fix for this? RUN USER=nobody doesn't work.

jkronk commented 1 year ago

It looks like the RUN USER=nobody is not able to be used well with the install prereqs script. I am attempting to create a new user and try to get the script to run using that newly created user. Will report back if that works.

jonititan commented 1 year ago

@jkronk did that work? I have same issue.

jkronk commented 1 year ago

@jkronk did that work? I have same issue.

It did, I ended up doing the following

.......
RUN apt-get install -y sudo lsb-release tzdata

RUN useradd -m dockeruser && echo "dockeruser:dockeruser" | chpasswd && adduser dockeruser sudo

RUN echo 'dockeruser ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

ENV SKIP_AP_GIT_CHECK=1
RUN su -c "Tools/environment_install/install-prereqs-ubuntu.sh -y" dockeruser

RUN export PATH=$PATH:$HOME/ardupilot/Tools/autotest
RUN export PATH=/usr/lib/ccache:$PATH

RUN python -m pip install empy
........
jkronk commented 1 year ago

I still am having an issue with the python path because I cannot call sim_vehicle from inside the ArduPlane directory

EDIT: got it working with: RUN export PATH=$PATH:/ardupilot/Tools/autotest