I am new to docker. I have been assigned with a task that uses Docker container for development. I followed the tutorial for installing the Docker and the containers on Windows 10, but I have the following error: network remaxmdcrm_remaxmd-network declared as external, but could not be found
The steps I’ve done so far are:
- Cloned the repository from GitHub.
- Installed Docker on my laptop.
- Once I installed Docker, I went in the root of my project and ran the following command.
docker-compose build -d -t docker-compose.yml
– docker-compose.yml being the file in the root dir. - I opened Docker app and I ran the images created.
- I ran the command
docker-compose up
. When I ran this command, the error I specified at the beginning appears.network remaxmdcrm_remaxmd-network declared as external, but could not be found
docker-compose.yml
services:
ui:
build:
context: .
dockerfile: Dockerfile.development
volumes:
- .:/app
ports:
- "5000:5000"
restart: unless-stopped
networks:
- remaxmdcrm_remaxmd-network
redis:
image: 'redis:alpine'
networks:
- remaxmdcrm_remaxmd-network
networks:
remaxmdcrm_remaxmd-network:
external: true
Ran: docker ps -a
ID IMAGE
5e6cf997487c remaxmd-site_ui:latest
451009e0a2a6 redis:alpine
85e7cde67d05 docmer-compose.yml:latest
I might do something wrong here. Can somebody help me? I much appreciate your time!
3
Answers
I solved the issue, finally. The issue came from the fact that I had in docker-compose.yml
remaxmdcrm_remaxmd-network
declared as external. The external network was not created during installation, thus I needed to create a bridging network. I ran the commanddocker network create "name_of_network"
For further details, here is the full documentation this
You can see
docker network ls
and usesbridge
networkYou shouldn’t have to run a command to create the network prior to running
docker compose
, Docker should create the network if it doesn’t exist. The reason you’re getting this error is because you’re declaring the network as external, which means that Docker expects it to already exist. If you need a new one, removeexternal: true