Development Tools Introduction to Docker Building Images Using Dockerfiles Building Images Using Dockerfiles

Thomas Le
Thomas Le
8,317 Points

Dockerfile link?

Hi! Unless I'm missing something, the dockerfile being used in the video wasn't linked in the teacher's notes! I'll just type it out for now since it's pretty short. Can someone update the links?

Thanks!

Steve Berrill
Steve Berrill
19,133 Points

Bump... yes the link i only see is to a full docker file on github which is very large.

1 Answer

Steve Berrill
Steve Berrill
19,133 Points

I had to type the docker file example out, here it is

# Base Image
FROM ubuntu:latest

# Commands to run to install dependencies
RUN apt-get update -y
RUN apt-get install -y python3

# When you pass commands to the container, what should interpret them
ENTRYPOINT ["python3"]

# Command to run when the container starts
CMD ["app.py"]

# Working directory
WORKDIR /app

# Copy apps from the local folder to the Docker container
COPY app.py app.py
COPY alternate.py alternate.py

# Make port available
EXPOSE 8080
Steve Berrill
Steve Berrill
19,133 Points

I also came across an issue where docker could not locte python3

"Unable to locate package python3"

so i had to change this command in the docker file so that they where joined with &&

from

# Commands to run to install dependencies
RUN apt-get update -y
RUN apt-get install -y python3

to

# Commands to run to install dependencies
RUN apt-get update && apt-get install -y python3