Docker : How to find the network my container is in?

To see what network(s) your container is on, assuming your container is called c1:

$ docker inspect c1 -f "{{json .NetworkSettings.Networks }}"

To disconnect your container from the first network (assuming your first network is called test-net):

$ docker network disconnect test-net c1

Then to reconnect it to another network (assuming it’s called test-net-2):

$ docker network connect test-net-2 c1

To check if two containers (or more) are on a network together:

$ docker network inspect test-net -f "{{json .Containers }}"

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)