Docker compose can not start service network not found after restart docker

JosepB picture JosepB · Jul 9, 2018 · Viewed 7.4k times · Source

I'm using docker for windows (Version 18.03.0-ce-win59 (16762)) in a windows 10 pro. All the containers run ok after running the command docker-compose -up -d. The problem is when I restart the docker service. Then, once restarted, all the containers are stoped and when I run the command docker-compose start -d the following error is shown:

Error response from daemon: network ccccccccccccc not found

I don't know what's happening. When I run the container using run and the --restart=always option everything works as expected. No error is shown on restart.

This is the docker-compose file:

version: '3'

services:
  service_1:
    image: image1
    restart: always
    build:
      context: C:/ProgramData/Docker/volumes/foo2
      dockerfile: Dockerfile
      args:
        ENTRY: "1"
    volumes:
      - C:/ProgramData/Docker/volumes/foo1:C:/foo1
      - C:/ProgramData/Docker/volumes/foo2:C:/foo2
  service_2:
    image: image2
    restart: always
    build:
      context: C:/ProgramData/Docker/volumes/foo2
      dockerfile: Dockerfile
      args:
        ENTRY: "2"
    volumes:
      - C:/ProgramData/Docker/volumes/foo1:C:/foo1
      - C:/ProgramData/Docker/volumes/foo2:C:/foo2
  service_3:
    image: image3
    restart: always
    build:
      context: C:/ProgramData/Docker/volumes/foo2
      dockerfile: Dockerfile
      args:
        ENTRY: "4"
    volumes:
      - C:/ProgramData/Docker/volumes/foo1:C:/foo1
      - C:/ProgramData/Docker/volumes/foo2:C:/foo2

The dockerfiles are like this:

FROM microsoft/dotnet-framework:3.5

ARG ENTRY
ENV my_env=$ENTRY

WORKDIR C:\\foo2

ENTRYPOINT C:/foo2/app.exe %my_env%

Answer

ws_ picture ws_ · Jun 18, 2019

The network has changed. I used docker network prune command to meet the same problem.Recreate the container would fix the problem. Docker would set up the network again for the new containers.

docker rm $(docker ps -qa)