I write a dockerfile to build a docker image. This docker image has installed cuda drivers with older verisions. So I need to uninstall them, and install some newer ones. Here is the part of the dockerfile.
ENTRYPOINT [ "/bin/bash", "-l", "-c" ]
RUN sudo yum remove -y xorg-x11-drv-nvidia nvidia-kmod cuda-drivers /usr/local/cuda-10.0
RUN rm -rf /usr/local/cuda-10.0
RUN wget https://developer.download.nvidia.com/compute/cuda/11.4.1/local_installers/cuda-repo-rhel7-11-4-local-11.4.1_470.57.02-1.x86_64.rpm
RUN sudo rpm -i cuda-repo-rhel7-11-4-local-11.4.1_470.57.02-1.x86_64.rpm
RUN sudo yum -y install nvidia-driver-latest-dkms cuda cuda-drivers; sudo yum clean all;
RUN sudo nvidia-smi
RUN export PATH=/usr/local/cuda-11.4/bin${PATH:+:${PATH}}
RUN export LD_LIBRARY_PATH=/usr/local/cuda-11.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
RUN wget http://developer.download.nvidia.com/compute/redist/cudnn/v8.2.2/cudnn-11.4-linux-x64-v8.2.2.26.tgz
RUN tar -zxf cudnn-11.4-linux-x64-v8.2.2.26.tgz
RUN sudo cp cuda/include/cudnn*.h /usr/local/cuda/include && sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64 && sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
RUN export LIBRARY_PATH=/usr/local/cuda/lib64${LIBRARY_PATH:+:${LIBRARY_PATH}}
RUN cd .. && rm -rf cuda && rm -rf cudnn-11.4-linux-x64-v8.2.2.26.tgz
RUN pip install torch==1.9.0 torchvision==0.10.0 torchaudio==0.9.0
However, after building the image, I find an error when call nvidia-smi:
Failed to initialize NVML: Driver/library version mismatch
Could you give me any advice to fix this problem?
PS: The version of OS is CentOS 7.
Related
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
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?
I have Dockerfile which have next command:
RUN source $PERLBREW_ROOT/etc/bashrc && perlbrew install $PERL_VERSION
Here layers start to rebuild:
Step 12/27 : RUN echo -e "\nif [ -f /opt/perlbrew/etc/bashrc ]; then\n\tsource /opt/perlbrew/etc/bashrc\nfi\n" >> /root/.bash_profile
---> Using cache
---> b18437df38fb
Step 13/27 : RUN source $PERLBREW_ROOT/etc/bashrc && perlbrew install $PERL_VERSION
---> Running in 3b76e5d4ae0a
Fetching perl 5.24.1 as /opt/perlbrew/dists/perl-5.24.1.tar.bz2
Download http://www.cpan.org/authors/id/S/SH/SHAY/perl-5.24.1.tar.bz2 to /opt/perlbrew/dists/perl-5.24.1.tar.bz2
Installing /opt/perlbrew/build/perl-5.24.1/perl-5.24.1 into /opt/perlbrew/perls/perl-5.24.1
Why cached layer is not used for this command?
UPD
The docker file:
FROM centos:latest
ARG PERLBREW_ROOT=/opt/perlbrew
ARG PERL_VERSION=5.24.1
ARG MONKEYMAN_DIR=/opt/monkeyman
RUN yum -y install yum-plugin-ovl
RUN yum -y upgrade
RUN yum -y install perl
RUN yum-builddep -y perl
RUN yum install -y bzip2 zip which
RUN yum groupinstall -y 'Development Tools'
RUN curl -L https://install.perlbrew.pl | bash
RUN echo -e "\nif [ -f /opt/perlbrew/etc/bashrc ]; then\n\tsource /opt/perlbrew/etc/bashrc
\nfi\n" >> /root/.bash_profile
RUN source $PERLBREW_ROOT/etc/bashrc && perlbrew install $PERL_VERSION
RUN source $PERLBREW_ROOT/etc/bashrc && perlbrew switch $PERL_VERSION
RUN source $PERLBREW_ROOT/etc/bashrc && perlbrew install-cpanm
RUN source $PERLBREW_ROOT/etc/bashrc && cpanm Carton
no arguments provided when build
UPD
$ docker --version
Docker version 1.13.1, build 07f3374/1.13.1
Docker Codes
# Import Ubuntu image to Docker
docker pull ubuntu:16.04
docker run -it ubuntu:16.04
# Instsall Python3 and pip3
apt-get update
apt-get install -y python3 python3-pip
# Install Selenium
pip3 install selenium
# Install BeautifulSoup4
pip3 install beautifulsoup4
# Install library for PhantomJS
apt-get install -y wget libfontconfig
# Downloading and installing binary
mkdir -p /home/root/src && cd &_
tar jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2
cd phantomjs-2.1.1-linux-x86_64/bin/
cp phantomjs /usr/local/bin/
# Installing font
apt-get install -y fonts-nanum*
Question
I am trying to import Ubuntu image to docker and install serveral packages inscluding python3, pip3, bs4, and PhantomJs. Then I want to save all this configurations in Docker as "ubuntu-phantomjs". As I am currently on Ubuntu image, anything that starts with 'docker' command do not work. How could I save my image?
Here is the dockerfile:
# Import Ubuntu image to Docker
FROM ubuntu:16.04
# Install Python3, pip3, library and fonts
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
wget libfontconfig \
fonts-nanum*
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install selenium beautifulsoup4
# Downloading and installing binary
RUN mkdir -p /home/root/src && cd &_ tar jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2 && cd phantomjs-2.1.1-linux-x86_64/bin/ && cp phantomjs /usr/local/bin/
Now after saving the code in file named dockerfile, open a terminal in the same directory as the one where file is stored, and run following command:
$ docker build -t ubuntu-phantomjs .
-t means that the target is ubuntu-phantomjs and . means that the context for docker is the current directory. The above dockerfile is not a standard one, and does not follow all good practices mentioned here. You can change this file according to your needs, read the documentations for more help.
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