Setting LD_LIBRARY_PATH to miniconda lib dir in docker ubuntu:20.04 breaks libp11-kit - ld

If I run in an ubuntu:20.04 docker image (docker run -it --rm ubuntu:20.04 bash) the following commands:
apt update
apt upgrade -y
apt install -y wget
wget https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh
bash Miniconda3-py310_23.1.0-1-Linux-x86_64.sh
source /root/.bashrc
export LD_LIBRARY_PATH=/root/miniconda3/lib:$LD_LIBRARY_PATH
then it breaks libp11-kit. For instance when running apt install vim:
/usr/lib/apt/methods/http: symbol lookup error: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined symbol: ffi_type_pointer, version LIBFFI_BASE_7.0
E: Method http has died unexpectedly!
E: Sub-process http returned an error code (127)
E: Method /usr/lib/apt/methods/http did not start correctly
I tried to add other directories to LD_LIBRARY_PATH (/usr/lib/, /lib/x86_64-linux-gnu/) without result.
Possibly related to conda-build fails to recognise libraries?

Related

Problems with NVIDIA-Linux-x86_64-470.63.01-grid.run to Deploy to Cloud Run

I'm trying to deploy on google cloud. So, my Dockerfile :
FROM ubuntu:20.04
RUN apt update
RUN apt -y install sudo
RUN apt -y install curl
RUN sudo apt install -y build-essential
RUN curl -O https://storage.googleapis.com/nvidia-drivers-us-public/GRID/GRID13.0/NVIDIA-Linux-x86_64-470.63.01-grid.run
RUN chmod +x NVIDIA-Linux-x86_64-470.63.01-grid.run
RUN sudo /bin/bash NVIDIA-Linux-x86_64-470.63.01-grid.run
FROM python:3.8
RUN adduser meat
RUN passwd -d meat
USER meat
WORKDIR /home/meat
RUN python3 -m venv meat-env
RUN /bin/bash -c "source meat-env/bin/activate"
RUN /usr/local/bin/python -m pip install --upgrade pip
COPY requirements.txt .
RUN pip3 install -r requirements.txt
COPY . .
CMD ["python", "main.py"]
and I got this error:
Step 8/20 : RUN sudo /bin/bash NVIDIA-Linux-x86_64-470.63.01-grid.run
---> Running in 811998f9cea8
Verifying archive integrity...
OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 470.63.01
...............
and several dots(.) later
[91mError opening terminal: unknown.
[0m
unable to stream build output: The command '/bin/sh -c sudo /bin/bash NVIDIA-Linux-x86_64-470.63.01-grid.run' returned a non-zero code: 1
Failed to build the app. Error: unable to stream build output: The command '/bin/sh -c sudo /bin/bash NVIDIA-Linux-x86_64-470.63.01-grid.run' returned a non-zero code: 1
I made something wrong with my Dockerfile? Or is there a differente way to do the command?
#DazWilkin's comment is correct:
It's not possible to install graphics driver to Cloud Run fully managed because it doesn't expose any GPU.
You should deploy it in Cloud Run Anthos(GKE). But you'll need to configure your GKE Cluster to install your GPU, According to the documentation, you should follow the steps:
Add a GPU-enabled node pool to your GKE cluster.
In this step, you can enable Enable Virtual Workstation (NVIDIA GRID). Please choose a GPU such as NVIDIA Tesla T4, P4 or P100 to enable NVIDIA GRID.
Install NVIDIA's device drivers to the nodes.
You can now create a service that will consume GPUs and deploy the image to Cloud Run for Anthos:
Setting up your service to consume GPUs

MongoDB connection failed in ubuntu container

I create a docker container with the base image ubuntu:18.04 and installed MongoDB using the shell in this container. Now, I commit and export this container and use this container image as a base image in a new container in which I need the MongoDB status as running for further process. I am using Dockerfile for both containers.
First Dockerfileis :
#getting base image ubuntu
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y apt-utils wget gnupg gnupg2 curl
ENTRYPOINT ["tail", "-f", "/dev/null"]
CMD ["echo","Create base image"]
After building this Dockerfile, I accessed shell installed MongoDB, created a new db and collection, commit and export in the tar file.
Next, I import this tar file as image mongoubuntu:1.0
Now, I create another Dockerfile in which I want to run some commands which need MongoDB status as running.
The second Dockerfile is as follows:
FROM mongoubuntu:1.0
RUN apt-get update && apt-get -y install sudo && apt-get -y install curl
RUN apt-get install -y wget #install wget lib
COPY . /
RUN chmod +x /genesis.sh
RUN /genesis.sh
RUN chmod +x /wallet.sh
RUN /wallet.sh >> /config.sh
ENTRYPOINT ["tail", "-f", "/dev/null"]
CMD ["echo","Install EOS Complete"]
When I run this as docker build -t eossample:1.5 . It gets build successful. When I check the bash shell for the newly created container using this image, MongoDB is not running. If I manually start MongoDB it shows running status. Please help. How could I start MongoDB from DockerFile?

How to fix ''mongod: command not found " error in AWS Cloud9

I want to install MongoDB in my AWS Cloud9 server. So I followed the instruction as the Cloud9 community page says, but the command to run the MongoDB server in c9 command line i.e.,
$ *./mongod* returns ./mongod: line 1: mongod: command not found.
help me to fix this.
I've tried searching about it on YouTube but it didn't work.
$ *sudo yum install -y mongodb-org*
Loaded plugins: priorities, update-motd, upgrade-helper
1062 packages excluded due to repository priority protections
No package mongodb-org available.
Error: Nothing to do
$ mkdir data
$ echo 'mongod --bind_ip=$IP --dbpath=data --nojournal --rest "$#"' > mongod
$ chmod a+x mongod
$ ./mongod
./mongod: line 1: mongod: command not found
We can start mongodb by running the mongod script on your project root:
command :- ./mongod
From the error given below, it is apparent that the mongo repo wasn't configured in your yum package manager.
vocstartsoft:~ $ sudo yum install -y mongodb-org
Loaded plugins: priorities, update-motd, upgrade-helper 1062 packages excluded due to repository priority protections No package mongodb-org available. Error: Nothing to do
Create /etc/yum.repos.d/mongodb-org-4.0.repo and write the following in it.
[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
Or add the repo directly from the .repo file,
yum-config-manager --add-repo https://repo.mongodb.org/yum/amazon/mongodb-org.repo
Then run,
sudo yum install -y mongodb-org
Reference
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
Either try this: sudo apt install mongodb-clients
Or consider the below process:
ubuntu:~/environment $ At the terminal you’ll see this.
Enter touch mongodb-org-3.6.repo into the terminal
Now open the mongodb-org-3.6.repo file in your code editor (select it from the left-hand file menu) and paste the following into it then save the file:
[mongodb-org-3.6]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.6/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc
* Now run the following in your terminal:
sudo mv mongodb-org-3.6.repo /etc/yum.repos.d
sudo yum install -y mongodb-org
If the second code does not work try:
sudo apt install mongodb-clients
Close the mongodb-org-3.6.repo file and press Close tab when prompted
Change directories back into root ~ by entering cd into the terminal then enter the following commands:
“ubuntu:~ $ “ - Terminal should look like this.
sudo mkdir -p /data/db
echo 'mongod --dbpath=data --nojournal' > mongod
chmod a+x mongod
Now test mongod with ./mongod
Remember, you must first enter cd to change directories into root ~ before running ./mongod
Don't forget to shut down ./mongod with ctrl + c each time you're done working
-if this error pops up while using command mongod
exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db, terminating
Then use the code:
sudo chmod -R go+w /data/db
Reference

PowerShell Core in Debian Docker Container Error

I'm new to Docker and am trying to create a Docker image with Raspbian base and PowerShell Core installed.
EDIT: Updated Dockerfile to include libicu52 package, which resolved the main error: lack of libpsl-native or dependencies not available. Changed CMD parameters and now have a different error.
Here is my Dockerfile:
# Download the latest RPi3 Debian image
FROM resin/raspberrypi3-debian:latest
# Update the image and install prerequisites
RUN apt-get update && apt-get install -y \
wget \
libicu52 \
libunwind8 \
&& apt-get clean
# Grab the latest tar.gz
RUN wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc.2/powershell-6.0.0-rc.2-linux-arm32.tar.gz
# Make folder to put PowerShell
RUN mkdir ~/powershell
# Unpack the tar.gz file
RUN tar -xvf ./powershell-6.0.0-rc.2-linux-arm32.tar.gz -C ~/powershell
# Run PowerShell
CMD pwsh -v
New error:
hostname: you must be root to change the host name
/bin/sh: 1: pwsh: not found
How do I resolve these errors?
Thanks in advance!
Instead of downloading from source and extracting it in your container, I'd recommend using the official apt installer packages for your Dockerfile from Microsoft's official Debian repository as described at:
https://learn.microsoft.com/en-us/powershell/scripting/setup/installing-powershell-core-on-macos-and-linux?view=powershell-6#debian-9
So transforming that to Dockerfile format:
# Install powershell related system components
RUN apt-get install -y \
gnupg curl apt-transport-https \
&& apt-get clean
# Import the public repository GPG keys
RUN curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# Register the Microsoft's Debian repository
RUN sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list'
# Install PowerShell
RUN apt-get update \
&& apt-get install -y \
powershell
# Start PowerShell
CMD pwsh
Alternatively you can also try to start from one of the original Microsoft docker Linux images, but of course then you need to solve then the raspberry installation for yourself:
https://hub.docker.com/r/microsoft/powershell/tags/

Not all pre-reqs install correctly for Hyperledger Composer

I've been following the Hyperledger Composer tutorial. I managed to install Ubuntu 16.04 on Hyper-V on my Windows 10 Enterprise. I then started on the following pre-req installation instructions:
https://hyperledger.github.io/composer/installing/installing-prereqs.html
I ran the prereqs-ubuntu.sh script. It ran fine with no errors. I examined the logs and saw that it had successfully installed npm 5.6.0, node 8.9.4, docker 17.12.x, docker composer 1.13.x, and Python 2.7.12.
However, when I run run $ sudo npm --version
it tells me that the npm command is not found
Same with $ sudo node --version
Not found...?!
Why would that be when the log clearly shows that npm and node where successfuly installed?!
Well, what I did and managed through:
--> install nodejs and npm:
sudo snap install node --classic --channel=8
so you get the latest node8.
--> then to solve "sudo" problem with node specify the npm prefix:
npm config set prefix ~/.node_modules
add the following to .bash_profile
export PATH=$HOME/.node_modules/bin:$PATH
Now the packages will install into your user directory and no permissions will be harmend.
--> install nvm (to get exactly node 8.9 version on the next step):
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
or
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
Verify:
node -v nvm
which should output 'nvm' if the installation was successful.
--> get and set node 8.9 version:
nvm install v8.9.0
nvm use 8.9.0
--> reset PATHs:
echo export PATH="$HOME/npm/bin:$PATH" >> ~/.bashrc
npm config set prefix ~/npm
echo "export NODE_PATH=$NODE_PATH:/home/$USER/npm/lib/node_modules" >> ~/.bashrc && source ~/.bashrc
--> at this stage the docker previous setup shall be destroyed:
docker kill $(docker ps -q)
docker rm $(docker ps -aq)
docker rmi $(docker images dev-* -q)
--> Installing the rest of prereqs:
sudo apt-add-repository -y ppa:git-core/ppa
sudo apt-get update
# install git
sudo apt-get install -y git
# Ensure that CA certificates are installed
sudo apt-get -y install apt-transport-https ca-certificates
# Add Docker repository key to APT keychain
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Update package lists
sudo apt-get update
# Verifies APT is pulling from the correct Repository
sudo apt-cache policy docker-ce
# Install Docker
echo "# Installing Docker"
sudo apt-get -y install docker-ce
# Add user account to the docker group
sudo usermod -aG docker $(whoami)
# Install docker compose
echo "# Installing Docker-Compose"
sudo curl -L "https://github.com/docker/compose/releases/download/1.13.0/docker-compose-$(uname -s)-$(uname -m)" \
-o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# Install unzip, required to install hyperledger fabric.
sudo apt-get -y install unzip
--> now you can install Fabric dev. env. (assuming the rest of prereq components stand available):
npm install -g composer-cli
etc.
I think you need to log out and close the shell. And then restart with the new session, as the shell stores your session.
Also, after installation, the use of sudo is not recommended as mentioned on IBM hyperledger website.