not able to start uwsgi as a service in docker - docker

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

Related

conda: not found - Docker container do not run export PATH=~/miniconda3/bin:$PATH

I have the following Dockerfile:
FROM --platform=linux/x86_64 nvidia/cuda:11.7.0-devel-ubuntu20.04
COPY app ./app
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y upgrade && apt-get install -y apt-utils
RUN apt-get install -y \
net-tools iputils-ping \
build-essential cmake git \
curl wget vim \
zip p7zip-full p7zip-rar \
imagemagick ffmpeg \
libomp5
# RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
COPY Miniconda3-latest-Linux-x86_64.sh .
RUN chmod guo+x Miniconda3-latest-Linux-x86_64.sh
RUN bash Miniconda3-latest-Linux-x86_64.sh -b -p ~/miniconda3
RUN export PATH=~/miniconda3/bin:$PATH
RUN conda --version
RUN conda update -n base conda
RUN conda create -y --name servier python=3.6
RUN conda activate servier
RUN conda install -c conda-forge rdkit
CMD ["bash"]
When I run: docker image build -t image_test_cuda2 . it breaks in the RUN conda --version.
The error is RUN conda --version: ... /bin/sh: 1: conda: not found. The problem is that RUN export PATH=~/miniconda3/bin:$PATH is not working. It is not creating conda link in the PATH.
If I build the image until RUN bash Miniconda3-latest-Linux-x86_64.sh -b -p ~/miniconda3 and manually I get access to the container using docker exec -it <id> /bin/bash and then from the #/ manually I run the same command #/export PATH=~/miniconda3/bin:$PATH it works good. If I manually run the next command inside the container RUN conda update -n base conda it works good.
The conclusion is that it seems that the command RUN export PATH=~/miniconda3/bin:$PATH is not working in Dockerfile - docker image build. How to solve this issue?

GUI menu in docker container freezes (ubuntu parent image)

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

how to pass url link in dockerfile to create different containers based on url argument

i have dockerfile which is;
FROM centos/systemd
CMD ["/usr/sbin/init"]
RUN yum install xorg-x11-server-Xorg xorg-x11-xauth xorg-x11-apps bzip2 wget gtk3 initscripts sudo -y
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y install xrdp tigervnc-server
RUN cd /usr/local
RUN wget http://ftp.mozilla.org/pub/firefox/releases/76.0/linux-x86_64/en-US/firefox-76.0.tar.bz2
RUN tar xvjf firefox-76.0.tar.bz2
RUN ln -s /firefox/firefox /usr/bin/firefox
RUN systemctl enable xrdp
RUN echo "/usr/bin/firefox --private-window --kiosk https://facebook.com" >~/.xsession
RUN chmod +x ~/.xsession
it creates image and then, containers generated from this image. but i want some containers open different url than
kiosk https://facebook.com
ie: twitter.com, instagram.com etc.
by using same image.
how can i pass this url argument?
is there a way that i can run it with my docker run command?
edit
my file.sh:
#!/bin/bash
url=$1
echo "/usr/bin/firefox --private-window --kiosk $url " >/root/.xsession
chmod +x /root/.xsession
tail -f /dev/null
dockerfile:
FROM centos/systemd
CMD ["/usr/sbin/init"]
RUN yum install xorg-x11-server-Xorg xorg-x11-xauth xorg-x11-apps bzip2 wget gtk3 initscripts sudo -y
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y install xrdp tigervnc-server
RUN cd /usr/local
RUN wget http://ftp.mozilla.org/pub/firefox/releases/76.0/linux-x86_64/en-US/firefox-76.0.tar.bz2
RUN tar xvjf firefox-76.0.tar.bz2
RUN ln -s /firefox/firefox /usr/bin/firefox
RUN systemctl enable xrdp
RUN touch ~/.xsession
COPY ./file.sh /
ENTRYPOINT ["/usr/sbin/init","-D","FOREGROUND","./file.sh"]
RUN echo 'root:basak' | chpasswd
but it still does not write url. where is the problem?

Getting an error with Chromedriver using docker

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"

Some RUNs won't work on docker but will when inside a container

I've got a Dockerfile for some lua and torch related tasks and I'm trying to install some rocks using luarocks.
FROM ubuntu:14.04
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get update -y
RUN apt-get install -y curl git
RUN curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash
RUN git clone https://github.com/torch/distro.git ~/torch --recursive
RUN cd ~/torch; ./install.sh
RUN source ~/.bashrc
RUN luarocks install nngraph
RUN luarocks install optim
RUN luarocks install nn
RUN luarocks install cltorch
RUN luarocks install clnn
docker build runs fine up until the first luarocks call: RUN luarocks install nngraph at which point it stops and throws the error:
/bin/sh: luarocks: command not found
If I comment out the luarocks lines, the build runs fine. Using that image, I can create a container and using bash, run luarocks as expected.
Of course, I don't particularly want to have to do this every time I start up the container, so I'm wondering if there's anything I can do to make this work. I have a feeling that this problem has something to do with the line RUN rm /bin/sh && ln -s /bin/bash /bin/sh but I need that to be able to run the line RUN source ~/.bashrc.
Thanks.
Each RUN command runs on its own shell and a new layer is committed.
From the Docker documentations:
RUN (the command is run in a shell - /bin/sh -c - shell
form)
So when you run luarocks install <app> it will not be the same shell you source your profile.
You have to provide the full path for luarocks to run. See below a modified Dockerfile I successfully run:
FROM ubuntu:14.04
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get update -y
RUN apt-get install -y curl git
RUN curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash
RUN git clone https://github.com/torch/distro.git ~/torch --recursive
RUN cd ~/torch; ./install.sh
RUN source ~/.bashrc
RUN /root/torch/install/bin/luarocks install nngraph
RUN /root/torch/install/bin/luarocks install optim
RUN /root/torch/install/bin/luarocks install nn
RUN /root/torch/install/bin/luarocks install cltorch
RUN /root/torch/install/bin/luarocks install clnn
For more details see docker RUN documentation here.
As Alex da Silva pointed it out, sourcing .bashrc happens in another shell in your Dockerfile.
You could also try that to have your luarocks commands executed in the same shell with your sourced bashrc:
...
RUN source ~/.bashrc && luarocks install nngraph
RUN source ~/.bashrc && luarocks install optim
RUN source ~/.bashrc && luarocks install nn
RUN source ~/.bashrc && luarocks install cltorch
RUN source ~/.bashrc && luarocks install clnn

Resources