2

I work in a Docker container that has a bunch of other Docker containers running inside. Every time the outer container is destroyed, I see that the images that were previously pulled from Docker Hub have to be pulled again.

In the example of Redis, I see the following

docker run --name my_redis -p 6379:6379 -d redis
Unable to find image 'redis:latest' locally
latest: Pulling from library/redis

and the process is taking a while to complete.

Is there a way to cache Redis so that the outer container can pick it up? Perhaps I just need to volume mount appropriate directories. Any advice is appreciated!

sakovias
  • 1,356
  • 1
  • 17
  • 26

1 Answers1

4

I see two options:

  • Use docker -g to configure where your inner docker instance stores its images. Make sure that this is a location outside of the inner docker instance that doesn't get blown away. Also see here.
  • Run a private docker registry that caches images locally. See here for details.

And a word of warning about running docker in docker.

Community
  • 1
  • 1
Jan Groth
  • 14,039
  • 5
  • 40
  • 55