docker-compose prompts user specified IP address is supported only when connecting to networks with user configured subnets
Some docker-compose.yml downloaded from the Internet encountered the following error many times during execution:
ERROR: for 5307e2acb....user specified IP address is supported only when connecting to networks with user configured subnets
It means that only the network created with --subnet can specify a static IP, that is, because there is a specified IP in the file to run the container, an error will be reported. The docker-compose.yml involved is generally as follows:
root@test: cat docker-compose.yml
service:
...
networks:
app_net:
ipv4_address: 172.16.238.10
networks:
app_net:
driver: bridge
ipam:
config:
- subnet: 172.16.238.0/24
gateway: 172.16.238.1
I haven't modified the docker-compose.yml file, and it reports an error when it is run directly. But not all places run with errors, and occasionally it is successfully executed on a server. Through groping, I found that there are several methods to try, at least I have solved the problem and started normally.
First: Delete the gateway line configuration.
When adjusting the gateway line, I encountered networks.demo_dev.ipam.config value Additional properties are not allowed ('gateway' was unexpected), and finally deleted this line, and it started normally.
Second: Execute docker system prune to clear some intermediate caches and other junk data.
A friend outside the wall has successfully used this method, Hello, My problem solved but I won't do anything. I was only run "docker system prune" command. Than I was defined static ip. If problem will continue, I will try your advice. Thank you for comment.
Third: Modify the networks configuration.
The networks configuration only retains the lines of networks and app_net. app_net is just a custom name that can be defined casually. All other network configurations are deleted, that is, let docker configure itself automatically. Do not specify. It's also totally doable.
0 Comments