When to pull from Docker repo and when from Git repo and then build?

like the other answers say, git is for version control, e.g. for textfiles.

You build a docker container from a “dockerfile” (which is a textfile).
This “dockerfile” is placed in a directory with many other files and folders.

So if you put this directory, where the dockerfile is located in, into a git repository, then everyone who has access to it, can build the same docker container, with the same configurations and everything.

is that what you mean?

So, the docker container is a “building” and the DOCKER-repository is a market where you can download already built buildings (images), from that you can run a virtualmachine/container.

And the files in the GIT-repository (this is like a big archive for e.g. documents) are the “construction plans”. You “share” the different version of the “construction plans” via git, so everyone can build every version of the building.

Example Workflow:

In your development environment (your local computer):

  1. git pull – pull the “construction – instructions” from git repository (e.g. dockerfile)
  2. docker build – build the docker image from that dockerfile-instructions
  3. docker push myDockerRepo/myDockerImage:latest – push the newly built docker image into the DOCKER repository (NOT the git-repository)

In your production environment:

  1. docker pull myDockerRepo/myDockerImage:latest – pull the latest docker image from the DOCKER-repository
  2. docker run – run a new containerized instance (basically a VirtualMachine) FROM the docker image

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)