Reputation: 93
I tried to remove a docker network that is connected to a container, but couldn't because the container is running. I then stopped the container and removed the network. When I tried to restart the container, it errored:
Error response from daemon: Cannot restart container my_container: network aa15e9d00da5e769af8305e25807973691e25032f0c0a6c76c84fb37446a4ff5 not found
I tried to connect to different networks but I can't. Is there any way to restart the container again now that the original network has been removed?
Upvotes: 2
Views: 6140
Reputation: 2915
config.v2.json
, update the NetworkID
with the new id in NetworkSettings.Networks
Upvotes: 2
Reputation: 93
After deleting the network the id of the deleted network is given in the output. We can recreate the same network using that id:
docker network create "deleted_network_id"
after the recreation connect that network to the container:
docker network connect "network_id" "container"
Upvotes: 6
Reputation: 11
Maybe this works:
docker run -itd --network=networkName containerName
https://docs.docker.com/engine/reference/commandline/network_connect/
Upvotes: 0