Python3 Dockerfile. Installs vi. Python dependencies are in requirements.txt. Creates a dev account
Python 3 Dockerfile
FROM python:3.6.1
RUN apt-get update -y && apt-get install -y vim
# Create the group and user to be used in this container
RUN groupadd devgroup && useradd -m -g devgroup -s /bin/bash dev
# Create the working directory (and set it as the working directory)
RUN mkdir -p /home/dev
WORKDIR /home/dev
# Install the package dependencies (this step is separated
# from copying all the source code to avoid having to
# re-install all python packages defined in requirements.txt
# whenever any source code change is made)
COPY requirements.txt /home/dev
RUN pip install --no-cache-dir -r requirements.txt
# Copy the source code into the container
COPY . /home/dev
RUN chown -R dev:devgroup /home/dev
USER dev
Basic usage
docker build -t sometag .
docker run -it sometag /bin/bash
docker exec -it sometag /bin/bash