How to check whether python package is installed or not in Docker?

三世轮回 提交于 2019-12-08 21:43:44

问题


I used Dockerfile successfully built a container. However, my code doesn't work in the container. It does work if I install all the packages manually. I'm assuming I messed up something that cause docker didn't install the packages properly. So, I want to check whether python package is installed or not in Docker container. What is the best way to check it?

The Dockerfile I used:

# Update the sources list
RUN sudo apt-get update

# Install basic applications
RUN sudo apt-get install -y tar git curl nano wget dialog net-tools build-essential

# First install ZeroMQ
RUN sudo apt-get install -y libzmq-dev

# Install libevent
RUN sudo apt-get install -y libevent-dev

# Install Python and Basic Python Tools
RUN sudo apt-get install -y python python-dev python-setuptools
RUN sudo apt-get install -y python-pip 

# Add the current directory to the container
ADD . /root/code

# Get pip to download and install requirements:
RUN sudo pip install -r /root/code/requirements.txt

# Expose ports
EXPOSE 80 4242

# Define working directory.
WORKDIR /root/code

# Start the tcp server.
CMD python app.py

The requirements.txt I used:

gevent==1.0.1
greenlet==0.4.5
msgpack-python==0.4.2
pyzmq==13.1.0
wsgiref==0.1.2
zerorpc==0.4.4

回答1:


I figured out.

docker exec <container ID> pip list


来源:https://stackoverflow.com/questions/27520619/how-to-check-whether-python-package-is-installed-or-not-in-docker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!