skip to Main Content

I tried to remove a costume network that is connected to a container. As you can imagine I didn’t, because of the container. I stopped it and then removed the network. When I tried to restart the container, I didn’t because the container is not connected to any network. Then tried to connect to different networks but I can’t. So, is there any way to restart that container again?

2

Answers


  1. Chosen as BEST ANSWER

    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"
    

  2. Maybe this works:

    docker run -itd --network=networkName containerName
    

    https://docs.docker.com/engine/reference/commandline/network_connect/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search