Lab 4, Question 8, Hint suggests… docker build -t webapp-color .
but when I do this, I get…
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /root/Dockerfile: no such file or directory
you have to perform this task in that directory where Dockerfile is present. or else do
$ sudo docker build --file="<Dockerfile path>" -t < tag-name >
Thanks, I am still trying to get comfortable with these commands. I was able to cd into the webapp-color repo and run the build command there.
I cannot find the path to Dockerfile hence getting the same error
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /root/Dockerfile: no such file or directory
Can you help me find the directory where Dockerfile is stored i tried cd command as well to search but coudnt find Dockerfile in any directory.
You can show the content of the DockerFile using the following command :
cat /root/webapp-color/Dockerfile
following command worked for me and created an image.
$ sudo docker build -file=“/root/webapp-color/Dockerfile” -t webapp-color
But when i tried to run container for the image, using following command
docker run -p 8282:8080 webapp-color
I got below error.
python: can’t open file ‘app.py’: [Errno 2] No such file or directory
I am having the same issue. I have tried the commands listed here but it’s not working.
Even i had same issue.
The following code worked for me
sudo docker build -f ‘/root/webapp-color/Dockerfile’ .
docker build -t webapp-color .
docker build -target webapp-color
worked for me
I have a question about this lab exercise.
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
.
How do we find the size of the docker image in the docker hub?
I tried using docker search command - > docker search python:3.6, but it doesn’t provide the size of the image.
Let me know if there is away to find the size of the docker image before pulling it.
When you search for a docker image on Docker hub , there will be 2 tabs- Repo Info and Tags . Open Tags tab and you will see the sizes of all the types of images you can pull for that image
@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
Kindly check the following:
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…
check for these
git clone GitHub - mmumshad/simple-webapp-flask: Simple Flask based web application
cd simple-webapp-flask/
docker build -t webapp-color .
docker pull python:3.6-slim
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
.
Check the steps in the attached gif https://kodekloud.com/community/uploads/db1265/original/2X/a/a32666104d5fedb43dc88a613da18f7e20927c80.gif
docker build -t webapp-color /root/webapp-color/
This worked for me
-
--tag
,-t
Name and optionally a tag in the ‘name:tag’ format
/root/webapp-color/ is the path