2

I have a .NET project with docker support, so I run docker-compose.yml with docker-compose.override.yml file - Windows OS with Linux docker containers.

My idea is to download all necessary images and then run that same docker-compose file without internet connection. So, i will have connection initially, download all the images, and then go offline and run the app.

Any idea how can I do that?

2
  • 2
    Download all necessary images using docker pull imagename and then run May 16, 2018 at 9:29
  • You've accurately described the solution. Please update the question with the steps you took to attempt solving the problem and error messages you encountered.
    – BMitch
    May 16, 2018 at 11:20

2 Answers 2

2

That should be no problem at all, if the images all exist locally docker-compose will just use them when you start.

As long as the images them selves doesn't require Internet of course.

6
  • 1
    yes but every time there is a check if images are up to date on hub, and for that docker requires connection...
    – zlaayaa
    May 16, 2018 at 9:30
  • Could you please describe the means of getting images to the local cache else the answer is incomplete? May 16, 2018 at 9:30
  • @zlaaya There is no check if images are up-to-date only available locally or not. In fact we had to write a wrapper tool to always fetch an up-to-date image if available May 16, 2018 at 9:31
  • i get an error in VS "An error occurred while sending thew request", so i assumed it is because docker tried to get latest version from hub. maybe making compose file independent from VS, and run from command line will do the job?
    – zlaayaa
    May 16, 2018 at 9:41
  • docker-compose will not check anything online. If the image is present locally it will be used. You can do docker-compose pull to force a re-download of images. I cannot attest to how VS does thing but try it command line just in case. May 16, 2018 at 11:17
2

Do below steps

  • First over the internet get to build all required docker images.
  • Then save/export those images in the tar file by using below command

    docker save image_name > /image/mynewimage.tar

  • The go offline, copy those tar file on another or same machine and load those images by using below command

    docker load < /image/mynewimage.tar

  • Then run normal docker run commands, you already have got all images locally hence docker will not try to get it download from the internet.

This should work, let me know if you need any help with this.

Please post your docker-compose file, if in case of any issue with above approach.

1
  • [just an idea] I am looking for some portable docker repository, where you can push the image and then plug that computer with intranet and run docker compose file to get the images May 7, 2019 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.