Skip to content

Instantly share code, notes, and snippets.

@goddoe
Last active January 3, 2018 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goddoe/ae58f67edb977f15bd922742165aec47 to your computer and use it in GitHub Desktop.
Save goddoe/ae58f67edb977f15bd922742165aec47 to your computer and use it in GitHub Desktop.
Simple examples for making Dockerfile, building docker image with dockerfile and running docker container.
docker build -t img_name:0.1 .
# Or, indicate specific Dockerfile
docker build -f Dockerfile_name -t img_name:0.1 .
FROM ubuntu:16.04
MAINTAINER company_name <user@email.com>
# Variables
ARG working_dir=/app
ENV WORKING_DIR=${working_dir}
# Update ubuntu & Install python3
RUN apt-get clean && apt-get update && apt-get upgrade -y
RUN apt-get install -y python3-dev
RUN rm -rf /var/lib/apt/lists/*
# Add application
RUN mkdir ${working_dir}
WORKDIR ${working_dir}
COPY ./run.py ${working_dir}/run.py
EXPOSE 8080
CMD ["python3", "run.py"]
# if run with Dockerfile CMD
docker run -v /path/to/src_host:/path/to/dst_container -p 8080:8080 -t ubuntu:16.04
# or
# when run container with bash, interactive mode
docker run -v /path/to/src_host:/path/to/dst_container -p 8080:8080 -it ubuntu:16.04 bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment