Python in docker container

I am new to Docker so I am sorry for such an easy question.

I am building a docker container which is built on top of a image which is built on ubuntu:vivid image.
When executing my script within the container I am getting an error:

  • Redis server does not start after install in Docker
  • With commited DOCKER container, the new container failed to run TOMCAT9 in Raspberry PI 3
  • docker on ubuntu 16.04 OCI error when launching container
  • Jenkins getting test results from docker slave
  • Quick way to add multiple RPM's to a dockerfile
  • Creating a docker image from an existing enviornment
  • exec: "python": executable file not found in $PATH
    

    How can I solve this?
    When I try to run apt-get install python in my Docker file:

    FROM my_image # based on ubuntu:vivid
    
    RUN apt-get update && \
        apt-get install -y python3
    
    ENV PATH /:$PATH
    
    COPY file.py /
    
    CMD ["python", "file.py", "-h"]
    

    I get:

    WARNING: The following packages cannot be authenticated!
      libexpat1 libffi6 libmagic1 libmpdec2 libssl1.0.0 libpython3.4-minimal
      mime-support libsqlite3-0 libpython3.4-stdlib python3.4-minimal
      python3-minimal python3.4 libpython3-stdlib dh-python python3 file
    E: There are problems and -y was used without --force-yes
    The command '/bin/sh -c apt-get update &&   apt-get install -y python3' returned a non-zero code: 100
    make: *** [image] Error 1
    

    EDIT: added Dockerfile content

  • MySQL stops randomically with Magento 2
  • Can't connect to mongodb instance running on docker-machine
  • How do I run private docker images on Google Container Engine
  • Unable to push docker image to Openshift Origin Docker registry
  • Wrong type error on an interface intended to test a method using Docker's client API
  • Inconsistency in running docker-build on different environment
  • One Solution collect form web for “Python in docker container”

    You have similar issue with some Linux distribution: “Why am I getting authentication errors for packages from an Ubuntu repository?”

    In all cases, the usual sequence of command to install new packages is:

    RUN apt-get update -yq && apt-get install -yqq \
        git \
        python \
        ...
    

    The OP Ela reports in the comments:

    RUN apt-get update -y && apt-get install -y --force-yes \
        git \
        python \
        ...
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.