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

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:

  • Error making http request across linked Docker containers
  • kube-ui dashboard 503 error caused by cAdvisor
  • Docker volume located in /tmp on OSX empty
  • When I use Deployment in Kubernetes, what's the differences between apps/v1beta1 and extensions/v1beta1?
  • docker rabbitmq crashing during startup
  • Docker centos:6 mounting webdav client with ec2 loadbalancer webdav server
  • # 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

    The requirements.txt I used:


  • GUI app in Docker not working
  • Boot2Docker Start up fails
  • How to flatten a Docker image?
  • How to access to a file in docker container already exit?
  • YARN DCE can not running
  • Docker Plugin for Jenkins error: Scripts not permitted to use method
  • One Solution collect form web for “How to check whether python package is installed or not in Docker?”

    I figured out.

    docker exec <container ID> pip list
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.