Video Capture in Docker doesn't work, why? - docker

How to properly install opencv-python and its dependencies in Docker, so we can use cv2.VideoCapture(0) ??
Because when I run the Docker container, VideoCapture returns False.

Related

Why can I not Import openCV after pip installing it to a docker container?

does anyone know why i cannot import cv2 in my python fuction after setting up a docker file. I do have the docker plug in, and docker desktop dowloaded. I just cant figure our why it is not working
DockerFile
I also did docker build . in the terminal.. i feel like i am missing a step, thanks

Error installing PyTorch when building Docker image

I run into this error when trying to build a Docker image. My requirements.txt file only contains 'torch==1.9.0'. This version clearly exists, but after downloading for a minute or longer, this error pops up.
There is a pytorch docker container on docker hub that has the latest releases: https://hub.docker.com/r/pytorch/pytorch/tags?page=1&ordering=last_updated
Maybe you can either base your docker container on that container (if it works for you) or you can compare the Dockerfile of your container with the Dockerfile of the container on docker hub to see if you are missing any system level dependencies or configurations...
Modify your Docker file to install requirements using:
RUN pip install -r requirements.txt --no-cache-dir
This will solve ram/memory related issues with large packages like torch.

Docker build: No matching distribution found

I try to build a docker image with pip RUN pip3 install *package* --index-url=*url* --trusted-host=*url*. However, it fails with the following error:
Could not find a version that satisfies the requirement *package* (from versions: )
No matching distribution found for *package*.
However, after I removed the package and successfully build the image, I could successfully install the package from docker container!
The bash I used to build image is: sudo docker build --network=host -t adelai:deploy . -f bernard.Dockerfile.
Please try
docker run --rm -ti python bash
Then run your pip ... inside this container.
The problem is solved: I set the environment variable during build (ARG http_proxy="*url*") and unset it (ENV http_proxy=) just before the installation.
I am not an expert in docker, but guess the reason is that the environment variables are discarded after the build, which cause the environments are different between dockerfile and docker container.
#Matthias Reissner gives a solid guide, but this answer absolutely provide a more detailed way to debug problems during docker building.

Is there a way to use conda to install libraries in a Docker image?

I'm trying to install some libraries (specifically pytorch) in my docker image. I have a Dockerfile that installs anaconda properly, but now I'd like to use conda to install a few other things in the image. Is there a way to do this? I've tried
RUN /opt/anaconda/bin/conda install -y pytorch torchvision
And anaconda is installed in the right location. Am I doing this the right way?
First, check if the way you have added/installed anaconda in your own image reflects the ContinuumIO/docker-images/anaconda.
Second, you can test the installation dynamically, as the README recommends
docker run -it yourImage /bin/bash -c "/opt/conda/bin/conda install ...
If that is working correctly, you can do the same in your Dockerfile.

docker odoo 9 install pika error

I have a simple docker build that I want to achieve. Pull the base image odoo:9 and install pika library
FROM odoo:9
RUN pip install pika
but can't proceed as I'm getting this error. enter image description here
btw, I am using docker in windows environment.
My solution is that, I just pull the Dockerfile from the official Docker Odoo. Add the line "&& pip install pika" as shown in the attached image. enter image description here
build again and you have a customize docker image with pika library installed.

Resources