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:

  • docker-compose with multiple databases
  • Does it make sense to dockerize (containerize) databases?
  • Elastic Beanstalk with Docker deployment failure
  • Docker Cannot link to a non running container
  • Avoid repeated program installation/configuration in container
  • How to open 3000 port on Amazon EC2 for Docker Container?
  • 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
    COPY /
    CMD ["python", "", "-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

  • docker-compose error Unicode-objects must be encoded before hashing
  • How to access private Docker repository in OpsWorks ECS Layer?
  • How do I connect a Docker container running in boot2docker to a network service running on another host?
  • How to dynamically set environment variables of linked containers?
  • Docker images for application packaging
  • Consul cluster automatic bootstrap on docker
  • 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.