'Is it possible the restart a docker container which it's network deleted?

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?



Solution 1:[1]

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"

Solution 2:[2]

Maybe this works:

docker run -itd --network=networkName containerName

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ?ükrü Karada?
Solution 2 vimscape