Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a Docker file stored locally

Tags:

I have a docker file that includes a python script. So far I pushed it to my github and from there to my docker hub. Afterwards I used the command

docker pull name/repo

I would like to store the docker file I created with a text editor in a folder together with the python scrip and execute it with a command like

docker run c:/pathtodockerfile

Is that possible?

like image 814
jz22 Avatar asked Jun 16 '17 13:06

jz22


People also ask

How do I run docker images locally?

You can also run a Docker image from your own Docker file using the docker-compose command. With compose, you can configure your application's services and then you can start all services with a single command. For example, set up a docker-compose. yml like this in your repository root (where the Dockerfile is):

How do I run a Dockerfile locally in Windows?

A Dockerfile must be created with no extension. To do this in Windows, create the file with your editor of choice, then save it with the notation "Dockerfile" (including the quotes). For additional examples of Dockerfiles for Windows, see the Dockerfile for Windows repository.

Where are docker files stored locally?

If you want to access the image data directly, it's usually stored in the following locations: Linux: /var/lib/docker/ Windows: C:ProgramDataDockerDesktop. macOS: ~/Library/Containers/com.


1 Answers

The process to run Dockerfile is:

docker build . -t [tag] -f /path/to/Dockerfile

And then:

docker run -d tag
like image 183
German Avatar answered Sep 26 '22 05:09

German