Docker network not found by docker-compose

[
    {
        "Name": "sharpnet",
        "Id": "c019cd176aea91b7de11aee5354bee708dd89f83dad4eb5522f46ded975133eb",
        "Created": "2020-12-20T19:25:07.293843001+01:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.30.0.0/16",
                    "Gateway": "172.30.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "08391c91f32b8a7529edefb706da372f90656a7e7506cc3581e34834641c2229": {
                "Name": "codeserver_task_webdev_1",
                "EndpointID": "587ac728db1567f6d4c53987326c15c7de2445a1608f5476b8404ae39c4e40fb",
                "MacAddress": "02:42:ac:1e:00:07",
                "IPv4Address": "172.30.0.7/16",
                "IPv6Address": ""
            },
            "161bbc4f83c5b5e2f1a5e62b2bf7ed03e6f19a70dcc85011760dcb4d16456e06": {
                "Name": "registery_task_registry_1",
                "EndpointID": "7eb213a741bd2919bc4b3c039ea01ecb42ea788676459284ab61cf51b03c362a",
                "MacAddress": "02:42:ac:1e:00:08",
                "IPv4Address": "172.30.0.8/16",
                "IPv6Address": ""
            },
            "1bff3bcd5a8a9700ba6c1618e7da3ac787e281d6f9dcf1c1dee949bdf126e246": {
                "Name": "sharpcdweb_task_sharpcdweb_1",
                "EndpointID": "4ec71a4ed702a9deebe1ffca5c4fb8eb2f6880beb223f6e2934e085f18a84374",
                "MacAddress": "02:42:ac:1e:00:03",
                "IPv4Address": "172.30.0.3/16",
                "IPv6Address": ""
            },
            "1bff61b264f9ddb247da935eb4315d40c72410820ee3adec7265a27ac6c425ff": {
                "Name": "vouch_task_vouch_1",
                "EndpointID": "dfab72ed96eb5997d544212f395d5093864f68efe8f69c4f71e96cd0c9028ef3",
                "MacAddress": "02:42:ac:1e:00:0a",
                "IPv4Address": "172.30.0.10/16",
                "IPv6Address": ""
            },
            "5218c06af0bd4b2b6e653eb33032b56a65a0531acf30a5caa63da7eec3f93fce": {
                "Name": "sharpfiles_task_sharpfiles_1",
                "EndpointID": "c8832fadd56cc51ae9cf881650d27a0f25de36895b71d7f387f2489ec5922c8a",
                "MacAddress": "02:42:ac:1e:00:05",
                "IPv4Address": "172.30.0.5/16",
                "IPv6Address": ""
            },
            "56dbb1869b15332eebb7afbab15d054b33467370b197923b71a2b462e6c65bd1": {
                "Name": "postgres_task_postgres_1",
                "EndpointID": "166d26fc197276eb5a8c465e4757b316474b7329a43ae8981431b3f043fffb66",
                "MacAddress": "02:42:ac:1e:00:09",
                "IPv4Address": "172.30.0.9/16",
                "IPv6Address": ""
            },
            "6202e7cdbce00a13f1489c6b3f50433677a92e685f63ccb5b34e58b7ac5726bf": {
                "Name": "postgres_task_pgadmin_1",
                "EndpointID": "19c3c7baccdfc1f45c3ea33c5ffadfb5e3b2e6ef543da638f2a518e6469397ca",
                "MacAddress": "02:42:ac:1e:00:02",
                "IPv4Address": "172.30.0.2/16",
                "IPv6Address": ""
            },
            "728bf0148566cd9bc8058ad354780d3efba4e0f90848e59877971cd6657c724f": {
                "Name": "sharpnet_sharpnet_1",
                "EndpointID": "6b3cdc348e96ea9b5885715ad4b69d85c223c048395f460ef5cede045bfd4fc2",
                "MacAddress": "02:42:ac:1e:00:06",
                "IPv4Address": "172.30.0.6/16",
                "IPv6Address": ""
            },
            "8c7c1be1127cf1e0f429024d9969bffc5c874b5549284592e08aac05fb21054b": {
                "Name": "codeserver_task_vscode_1",
                "EndpointID": "f9fecbeeaef59dfd1ce2b508e5ba76720cfce2d7b7704566a038ab04973765ee",
                "MacAddress": "02:42:ac:1e:00:0b",
                "IPv4Address": "172.30.0.11/16",
                "IPv6Address": ""
            },
            "e10a075481ddb8b08d39122843824240859eddd317a130d2a7ff2bcd048b8cd3": {
                "Name": "adam_task_adammcaq_1",
                "EndpointID": "36a00cee1ca940cd17ef53ddce25780e6d25ad7d7a12fa99abba58a8f16889c2",
                "MacAddress": "02:42:ac:1e:00:04",
                "IPv4Address": "172.30.0.4/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

My network “sharpnet” clearly exists, with the container “sharpnet” being connected to it, yet

adam@vmi261078:/usr/local/bin/sharpcd-data/docker/sharpnet$ sudo docker-compose up -d
ERROR: Network "sharpnet" declared as external, but could not be found. Please create the network manually using `docker network create "sharpnet"` and try again.
adam@vmi261078:/usr/local/bin/sharpcd-data/docker/sharpnet$

Docker-compose seems to fail to find anything, even tho the container is running - I can check its logs

docker-compose version 1.24.1, build 4667896b
docker-py version: 3.7.3
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j  20 Nov 2018
Docker version 19.03.1, build 74b1e89

What is your environment? Do you connect to a remote docker socket?

Dou you mean it cannot find containers or just “sharpnet” network or any network?

Is it possible it cannot find your docker socket as root or it uses an other context to connect to a different server?

When running docker-compose down/up it cannot find the “sharpnet” network, but when I run docker-compose logs it shows the container running fine.

i.e The container is running but it will not let me run docker-compose down or up

I don’t understand. How did you start the container in the first place?

Can you create a new compose project and use the same external network in that?

This is why I am confused you see hahah

I ran this container a few weeks ago. Could it be something to do with me running apt update && apt upgrade?

With your 2nd suggestion let me try that in the morning cheers.

You should not let apt to upgrade Docker on a server but I don’t know how that could cause this issue.

May I ask which docker package from which repo you use?
The combination of “Could it be something to do with me running apt update && apt upgrade?” and the docker version seen in the output of docker-compose version is suspicous.

I strongly advise to use the package from docker’s official repositores, as those are guaranteed to work as documented. Other dock re-distributions may behave different in aspects as os or repo mainter typicaly allign docker’s behavior to their own philosophy. The worst example for this is the snap package, which basicly breaks docker’s default behavior just to make it allign with the “snap philosopy” - I consider it broken/useless.

If persistant data for all containers is stored outside the container using volumes, It should be a quick task to bring down the stack and delete the network and start over with a fresh slate.