Some of the programs that I'd like to have in my docker container are some what hard to get on Debian. So I decided to use arch linux and one of the programs that I need is x86_64-elf-gcc. since it is on the AUR I'm currently trying to install paru.
Unfortunately dough makepkg has to be run by a normal user with sudo privileges.
Is there some way I could run it as root?
Or can I create such a user in a docker container and then use some flags so makepkg doesn't use sudo?
This is what I have done so far:
FROM archlinux
RUN pacman -Sy --noconfirm
RUN pacman -Syu --noconfirm
RUN pacman -S cmake --noconfirm
RUN pacman -S git --noconfirm
RUN pacman -S base-devel --noconfirm
WORKDIR /tmp
RUN useradd dev -G wheel -d /buildenv -p password
USER dev
RUN git clone https://aur.archlinux.org/paru.git
WORKDIR /tmp/paru
RUN makepkg -si
This does not work since dev does not have sudo privileges and sudo can't even be run since there is no terminal.
This is the error I get:
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
==> ERROR: 'pacman' failed to install missing dependencies.
You could remove the password requirement. For example
RUN useradd -m -G wheel -s /bin/bash debug
RUN sed -Ei 's/^#\ (%wheel.*NOPASSWD.*)/\1/' /etc/sudoers
USER debug
WORKDIR /home/debug/
RUN git clone https://aur.archlinux.org/paru.git && cd paru \
&& makepkg -si --noconfirm && cd .. && rm -rf paru
Related
Multiple Questions have been asked, but neither the solutions nor the suggestions work for me. I am using the manjarolinux docker. The image installs most of the stuff in the dockerfile:
FROM manjarolinux/base
RUN pacman-mirrors -g
RUN pacman -Syy
RUN rm -fr /etc/pacman.d/gnupg
RUN pacman-key --init
RUN pacman-key --populate archlinux
RUN pacman-key --populate manjaro
# RUN pacman-key --refresh-keys
RUN pacman -Syyu --noconfirm
RUN pacman -S --noconfirm gnupg
RUN pacman -Fyy --noconfirm
RUN pacman -Sy --noconfirm vim git gzip yay # this line
RUN pacman -Sy --noconfirm sudo fakeroot make
RUN pacman -Sy --noconfirm gcc clang
RUN groupadd sudo wheel
RUN useradd -m -d /home/manjarouser -s /bin/zsh -g sudo wheel manjarouser
USER manjarouser
However, after the line marked with this line, the build simply freezes:
#d4rk4ng31, my Archlinux custom docker container was doing the same thing in my build process. I was not able to pinpoint the exact reason, but it comes from a post-transaction hook in systemd (/usr/bin/systemd-tmpfiles --create). If you were to launch a basic container with docker run -it --rm manjarolinux/base bash and run that command, it would hang your container.
In my case, it was because I was using archlinux/base, which is now deprecated. Simply changing to the following fixed my issue:
FROM archlinux
I would verify if there is a similar deprecation issue going on with Manjaro.
I've been trying to run a docker container including the esp8266 toolchain and ESP8266_RTOS_SDK.
After the Dockerfile is done the 'Espressif IoT Menu' pops up but freezes instantly and I cant control anything. Screenshot of the menu. I thought maybe I had to run the container endlessly, but it didn't help either. I tried this command: RUN tail -f /dev/null.
What else I thought is that the container might be missing some programs for a terminal?
Here is my Dockerfile (first time working with docker):
FROM ubuntu:latest
# -------------------------- TOOLCHAIN --------------------------------------
WORKDIR /
RUN apt-get update && apt-get install -y software-properties-common
RUN apt update && add-apt-repository universe
RUN apt-get -y install gcc wget git make libncurses-dev flex bison gperf python3 python3-serial python3-pip
RUN mkdir -p downloads esp8266
ADD https://dl.espressif.com/dl/xtensa-lx106-elf-linux64-1.22.0-100-ge567ec7-5.2.0.tar.gz downloads
RUN cd esp8266;tar -xzf /downloads/xtensa-lx106-elf-linux64-1.22.0-100-ge567ec7-5.2.0.tar.gz
ENV PATH=/esp8266/xtensa-lx106-elf/bin:$PATH
# -------------------------- ESP8266_RTOS_SDK ---------------------------------
RUN cd esp8266;git clone https://github.com/espressif/ESP8266_RTOS_SDK.git
ENV IDF_PATH="/esp8266/ESP8266_RTOS_SDK"
RUN ln -s /usr/bin/python3 /usr/bin/python #otherwise python wont be found
ENV TERM xterm #otherwise "terminal unknown"
RUN python3 -m pip install --user -r $IDF_PATH/requirements.txt
RUN cd esp8266;cp -r $IDF_PATH/examples/get-started/hello_world .
RUN cd /esp8266/hello_world;make menuconfig
I run the container with:
sudo docker build -f $(pwd)/dEsp8266 -t espenv .
The guide's I used:
For the toolchain: https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/linux-setup.html
For the RTOS_SDK: https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/index.html#get-started-get-esp-idf
Below are details of the Docker file:
FROM python:3
RUN python3 -m pip install robotframework==3.0.4
RUN python3 -m pip install robotframework-seleniumlibrary==3.2.0
RUN python3 -m pip install selenium==3.14.0
# Install Chrome for Selenium
RUN curl https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /chrome.deb
RUN dpkg -i /chrome.deb || apt-get install -yf
RUN rm /chrome.deb
# Install chromedriver for Selenium
RUN curl https://chromedriver.storage.googleapis.com/2.42/chromedriver_linux64.zip -o /usr/local/bin/chromedriver
RUN unzip -o /usr/local/bin/chromedriver -d /usr/local/bin
RUN chmod 777 /usr/local/bin/chromedriver
After that, executed below commands:
sudo docker build -t rb/robot-docker
sudo docker run -ti -v /home/Automation:/usr/src/project rb/robot-docker bash
root> cd /usr/src/project
root> robot sample-0-trivial/sample-0-trivial.txt
It gives the error message as:
"WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127"
1)I have copied my demo.ini file inside /etc/uwsgi/app-enabled/demo.ini
2)I have installed the package apt-get install uwsgi-plugin-python
3)Added the plugins= python in demi.ini file
now when i hit the command sudo service uwsgi status it shows output which?
FROM base_image
RUN apt-get -y install uwsgi
COPY workspace /home/nt/workspace
RUN ln -s /home/nt/workspace/backend.conf /etc/nginx/sites-enabled/backend.conf
RUN ln -s /home/nt/workspace/nti-backend/environment/development.ini /etc/uwsgi/apps-enabled/
RUN pip install -r /home/nt/workspace/nti-backend/requirements.txt
ENTRYPOINT sh /home/nt/workspace/startup.sh && /bin/bash
I am trying to build a docker image using the following docker file.
FROM ubuntu:latest
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Update packages
RUN apt-get -y update && apt-get install -y \
curl \
build-essential \
libssl-dev \
git \
&& rm -rf /var/lib/apt/lists/*
ENV APP_NAME testapp
ENV NODE_VERSION 5.10
ENV SERVE_PORT 8080
ENV LIVE_RELOAD_PORT 8888
# Install nvm, node, and angular
RUN (curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash -) \
&& source /root/.nvm/nvm.sh \
&& nvm install $NODE_VERSION \
&& npm install -g angular-cli \
&& ng new $APP_NAME \
&& cd $APP_NAME \
&& npm run postinstall
EXPOSE $SERVE_PORT $LIVE_RELOAD_PORT
WORKDIR $APP_NAME
EXPOSE 8080
CMD ["node", "-v"]
But I keep getting an error when trying to run it:
docker: Error response from daemon: Container command 'node' not found or does not exist..
I know node is being properly installed because if I rebuild the image by commenting out the CMD line from the docker file
#CMD ["node", "-v"]
And then start a shell session
docker run -it testimage
I can see that all my dependencies are there and return proper results
node -v
v5.10.1
.....
ng -v
angular-cli: 1.0.0-beta.5
node: 5.10.1
os: linux x64
So my question is. Why is the CMD in Dockerfile not able to run these and how can I fix it?
When using the shell to RUN node via nvm, you have sourced the nvm.sh file and it will have a $PATH variable set in it's environment to search for executable files via nvm.
When you run commands via docker run it will only inject a default PATH
docker run <your-ubuntu-image> echo $PATH
docker run <your-ubuntu-image> which node
docker run <your-ubuntu-image> nvm which node
Specifying a CMD with an array execs a binary directly without a shell or a $PATH to lookup.
Provide the full path to your node binary.
CMD ["/bin/node","-v"]
It's better to use the node binary rather than the nvm helper scripts due to the way dockers signal processing works. It might be easier to use the node apt packages in docker rather than nvm.