@mmumshad I’m getting the below error when I try to build dockerfile using tag webapp-color.
$ docker build . -t webapp-color
Sending build context to Docker daemon 121.3kB
Step 1/6 : FROM python:3.6
—> f3411dca4721
Step 2/6 : RUN pip install flask
—> Running in 38c5fec65ebb
ERROR: Could not find a version that satisfies the requirement flask (from versions: none)
ERROR: No matching distribution found for flask
The command ‘/bin/sh -c pip install flask’ returned a non-zero code: 1
The issue is the symbolic link is not created, either you can create symbolic link or else move to the directory webapp-color and execute the command.
I assume you are in the root directory, run this command to find your directory “PWD”
if it says /root, then
$cd webapp-color
$docker build -t webapp-color .
That should work without any issues.
Cheers, all the best…
What is the answer of question 14 at the labs Docker images…
Question is this?
Build a new smaller docker image by modifying the same Dockerfile and name it webapp-color and tag it lite .
Hint: Find a smaller base image for python:3.6 . Make sure the final image is less than 150MB .
@tejaswinidp96 thanks for responding. I was trying in otherway to explicitly referring dockerfile using --file option.
Not sure if it is right way to build image other than running it from current directory
I see what is happening here. If I understand it correctly you want the context from another directory, in which case you should proceed with something like:
enter on Docker through
cd /root/webapp-color
ls
cat Dockerfile
Copy Dockerfile then create Dockerfile by " touch Dockerfile"
" nano Dockerfile " to enter on Dockerfile
[ write this code in Dockerfile ]
FROM python:3.0-alpine >>>> to minimize the size
RUN pip install flask
COPY . /opt/
EXPOSE 8080
WORKDIR /opt/
ENTRYPOINT [“python”,“app.py”]