Hi Support Team @Ayman @Tej-Singh-Rana
Can you help me to solve below. I have ran docker container in detach mode but not able to see it as running
$ docker run --name python_1test -d python:3.6
f845ed5c2e6a6c6670ceba9ca938701662195dc1472caa676f6ce3f426a2ba52
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4ec46df02651 webapp-color “python app.py” 12 minutes ago Up 11 minutes 8080/tcp webapp_test
Also I cannot able to build image by specifying dockerfile path explicitly.
$ sudo docker build --file=“/root/webapp-color/Dockerfile” -t webapp-color
“docker build” requires exactly 1 argument.
See ‘docker build --help’.
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile
1 Like
Simply go to that directory and run the below command: -
sudo docker build -t webapp-color .
Make sure to use the dot (.) symbol at the end of the command.
Regards,
@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
@Tej-Singh-Rana @Ayman ca someone please suggest here
Manikumar-Kandukuri:
s
Please check this example. @Manikumar-Kandukuri
Hey @Manikumar-Kandukuri ,
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:
$ sudo docker build -t webapp-color /root/webapp-color/
I think you have confused build context with the Dockerfile name .
--file
: Used when you have multiple Dockerfiles and you want to specify which one to use when building the docker image.
Context : This is the directory from where docker will fetch these Dockerfiles.
Attaching one screenshot for a more clear picture.
Hope it helps. Let me know if you have other queries as well.
Regards,
Thanks a lot @Dinesh_Kodekloud . works perfectly.
Thanks @Tej-Singh-Rana for sharing me documentation
Step 1: Find slim version of img - pull python:3.6-slim
Step2: edit dockerfile using vim cmd (save changes by pressing esc then :w)
Step 3: docker build -f Dockerfile -t webapp-color:lite .