Last active
January 3, 2018 08:08
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker build -t img_name:0.1 . | |
# Or, indicate specific Dockerfile | |
docker build -f Dockerfile_name -t img_name:0.1 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:16.04 | |
MAINTAINER company_name <[email protected]> | |
# 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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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