Posted by : at

Category : docker

Building images with Dockerfiles

  • Using Dockerfile - Defining a container with Dockerfile

Commands to use :

FROM - The base image to use in the build MAINTAINER - File Author/ Maintainer RUN - Install dependencies ADD - copies a file from the host-system to the container WORKDIR - set the default working directory in the container

Custom Dockerfile for setting ubuntu16.04 with python3.6

Create a new file “Dockerfile” - This file will be used to setup our container. We mention all the steps here that needs to be performed in our container.

FROM ubuntu:16.04
MAINTAINER [email protected]
# setup repository url

RUN apt-get update -o Acquire::CompressionTypes::Order::=gz
RUN apt-get upgrade -y
RUN apt-get update

RUN apt-get install -y software-properties-common python-software-properties
RUN add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update

# install python3.6
RUN apt-get install -y python3.6 python3.6-dev python3-pip python3.6-venv

# install git
RUN apt-get install -y git

# update pip
RUN  pip install pip --upgrade
RUN  pip install wheel

Now building the docker file :

$ docker build -t ubuntu-py3 .

Run the docker image

$ docker run -i -t ubuntu-py3 /bin/bash