Docker Community Forums

Share and learn in the Docker community.

Changing context directory for Dockerfile causes long delays in build

I have a docker-compose.yml file that I am using to build our container group that works great until I change the context for a service, at which point it will sit and wait for 30 min or more before creating the container.

I started off with a service like this:

# Redis Service
redis:
    build:
       context: .
       dockerfile: docker/redis/Dockerfile
    image: ura/redis
    container_name: redis
    restart: unless-stopped
    environment:
       CONTAINER_ROLE: redis
    tty: true
    ports:
        - "16379:6379"
    volumes:
        - redis_data:/data

This works great, will build the container in about 60 - 90 seconds. However, if I update it to something like this:

# Redis Service
redis:
    build:
       context: ./../
       dockerfile: ${IONIC_API_FOLDER}/docker/redis/Dockerfile
    image: ura/redis
    container_name: redis
    restart: unless-stopped
    environment:
       CONTAINER_ROLE: redis
    tty: true
    ports:
       - "16379:6379"
    volumes:
       - redis_data:/data

This will output the line

Building Redis

And then just sit there for 30-45 minutes before building the container. I have tried to do web searches to be able to find the issue, but I have been unable to come across anyone who seems to hit the same issue.

A little background on the project:

The reason for the change in context is that we are currently using a single docker-compose.yml file to link together 2 projects that need to be running in the same container group so that our Nginx proxy can route requests to the correct container. My question is why is it that just changing the context directory can add so much time into the build process?

I am using currently running Docker Desktop for Windows 2.1.0.5 ( please don’t recommend that I upgrade to 2.2* as there currently seems to be a bug in data volume binding that forced us to roll back to 2.1.0.5 ).

Any constructive feedback or hints would be most welcome right now.