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:

  • CentOS image is not running?
  • Docker - Run Container from Inside Container
  • Docker and node_modules - put them in a layer, or a volume?
  • Commands in Docker ENTRYPOINT
  • How specify the size of a shared Docker volume?
  • Is Alpine Linux an implementation of a Unikernel?
  • 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

  • Running .Net Core in Docker in Windows Subsystem for Linux
  • GUI app in Docker not working
  • Write to /etc/hosts in docker container when running docker container
  • Mounting directory from parent system to container in docker
  • How to link docker containers on Container VM with an manifest?
  • Docker image TCP buffer size
  • 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.