Often times it's best to start from a known (supported) image. A lot to learn from how those are configured.

If you need a custom one, it's fine to track settings in your own Dockerfile. Here are some examples.


FROM python:3

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "./" ]

$ docker build -t my-python-app . $ docker run -it --rm --name my-running-app my-python-app


FROM node:lts

# Use the official image as a parent image.
FROM node:current-slim

# Set the working directory.
WORKDIR /usr/src/app

# Copy the file from your host to your current location.
COPY package.json .

# Run the command inside your image filesystem.
RUN npm install

# Inform Docker that the container is listening on the specified port at runtime.

# Run the specified command within the container.
CMD [ "npm", "start" ]

# Copy the rest of your app's source code from your host to your image filesystem.
COPY . .