metabrainz / musicbrainz-docker

Docker Compose project for the MusicBrainz Server with replication, search, and development setup
https://musicbrainz.org/doc/MusicBrainz_Server/Setup
305 stars 79 forks source link

Installation step "Build docker images" fails currently for DB #28 #249

Closed PeterCodar closed 1 year ago

PeterCodar commented 1 year ago

Fresh installed Ubuntu 22.04.2. LTS with all available updates.

Step 2: https://github.com/metabrainz/musicbrainz-docker#build-docker-images (without previous admin/configure with alt-db-only-mirror)

mbdocker@VM-MBDocker-S28:~/musicbrainz-docker$ sudo docker-compose build
redis uses an image, skipping
Building db
Sending build context to Docker daemon  3.072kB
Step 1/8 : ARG POSTGRES_VERSION=12
Step 2/8 : FROM postgres:${POSTGRES_VERSION}
Get "https://registry-1.docker.io/v2/": read tcp 192.168.1.61:50048->34.194.164.123:443: read: connection reset by peer
ERROR: Service 'db' failed to build : Build failed
mbdocker@VM-MBDocker-S28:~/musicbrainz-docker$ 

Could this be an IP/network problem?


mbdocker@VM-MBDocker-S28:~/musicbrainz-docker$ echo MusicBrainz Docker: `git describe --always --broken --dirty --tags` && \
echo Docker Compose: `docker-compose version --short` && \
sudo docker version -f 'Docker Client/Server: {{.Client.Version}}/{{.Server.Version}}'
MusicBrainz Docker: v-2023-05-16-mbdb28
Docker Compose: 1.29.2
Docker Client/Server: 20.10.21/20.10.21
mbdocker@VM-MBDocker-S28:~/musicbrainz-docker$ 
PeterCodar commented 1 year ago

Update after a restart of Ubuntu and execution of the same command:

mbdocker@VM-MBDocker-S28:~$ cd musicbrainz-docker/
mbdocker@VM-MBDocker-S28:~/musicbrainz-docker$ sudo docker-compose build
[sudo] password for mbdocker: 
redis uses an image, skipping
Building db
Sending build context to Docker daemon  3.072kB
Step 1/8 : ARG POSTGRES_VERSION=12
Step 2/8 : FROM postgres:${POSTGRES_VERSION}
Head "https://registry-1.docker.io/v2/library/postgres/manifests/12": Get "https://auth.docker.io/token?scope=repository%3Alibrary%2Fpostgres%3Apull&service=registry.docker.io": read tcp 192.168.1.61:43618->52.1.184.176:443: read: connection reset by peer
ERROR: Service 'db' failed to build : Build failed
mbdocker@VM-MBDocker-S28:~/musicbrainz-docker$ 
yvanzo commented 1 year ago

I just rebuilt image for db and it passed the step 2/8 in no time:

sudo docker-compose build --pull --no-cache db

Edit: The whole build for db took ~5min

PeterCodar commented 1 year ago

Unfortunately not for me:

sudo docker-compose build --pull --no-cache db results in:

mbdocker@VM-MBDocker-S28:~$ cd musicbrainz-docker/
mbdocker@VM-MBDocker-S28:~/musicbrainz-docker$ sudo docker-compose build --pull --no-cache db
[sudo] password for mbdocker: 
Building db
Sending build context to Docker daemon  3.072kB
Step 1/8 : ARG POSTGRES_VERSION=12
Step 2/8 : FROM postgres:${POSTGRES_VERSION}
Get "https://registry-1.docker.io/v2/": read tcp 192.168.1.61:42636->18.215.138.58:443: read: connection reset by peer
ERROR: Service 'db' failed to build : Build failed
mbdocker@VM-MBDocker-S28:~/musicbrainz-docker$ 
PeterCodar commented 1 year ago

Just guessing:

The url https://registry-1.docker.io/v2/library/python/manifests/3.10 requires authorization. Do you have provided it on your Dockerfile?

Source: https://stackoverflow.com/questions/74739224/docker-cant-connect-to-internet-connection-reset-by-peer-error

yvanzo commented 1 year ago

This is likely a network issue.

Try adding Google public DNS servers to the file /etc/resolv.conf of your VM:

nameserver 8.8.8.8
nameserver 8.8.4.4

If you are behind a proxy, see: https://docs.docker.com/network/proxy/

Otherwise, it might be related to VM settings.

yvanzo commented 1 year ago

I tried the same build command after wiping out my ~/.docker/config.json and still passed.

yvanzo commented 1 year ago

Also please provide versions info as instructed at https://github.com/metabrainz/musicbrainz-docker#issues

PeterCodar commented 1 year ago

Please have a look at my initial question:

MusicBrainz Docker: v-2023-05-16-mbdb28
Docker Compose: 1.29.2
Docker Client/Server: 20.10.21/20.10.21
mbdocker@VM-MBDocker-S28:~/musicbrainz-docker$ 
PeterCodar commented 1 year ago

Changing the /etc/resolv.conf didn't help:

mbdocker@VM-MBDocker-S28:~$ cd musicbrainz-docker/
mbdocker@VM-MBDocker-S28:~/musicbrainz-docker$ sudo docker-compose build
[sudo] password for mbdocker: 
redis uses an image, skipping
Building db
Sending build context to Docker daemon  3.072kB
Step 1/8 : ARG POSTGRES_VERSION=12
Step 2/8 : FROM postgres:${POSTGRES_VERSION}
Get "https://registry-1.docker.io/v2/library/postgres/manifests/sha256:0941dc788046d517b7c38f2cc26749346496b19d6233024ee3e60896b2178d1f": read tcp 192.168.1.61:44638->52.1.184.176:443: read: connection reset by peer
ERROR: Service 'db' failed to build : Build failed
mbdocker@VM-MBDocker-S28:~/musicbrainz-docker$ 
yvanzo commented 1 year ago

Try downloading a bit of the image to check potential network issues:

wget docker.io/library/postgres:12@sha256:0941dc788046d517b7c38f2cc26749346496b19d6233024ee3e60896b2178d1f
PeterCodar commented 1 year ago
mbdocker@VM-MBDocker-S28:~/musicbrainz-docker$ wget docker.io/library/postgres:12@sha256:0941dc788046d517b7c38f2cc26749346496b19d6233024ee3e60896b2178d1f
--2023-05-16 19:57:03--  http://docker.io/library/postgres:12@sha256:0941dc788046d517b7c38f2cc26749346496b19d6233024ee3e60896b2178d1f
Resolving docker.io (docker.io)... 52.3.144.121, 54.165.156.197, 44.196.175.70
Connecting to docker.io (docker.io)|52.3.144.121|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://docker.io/library/postgres:12@sha256:0941dc788046d517b7c38f2cc26749346496b19d6233024ee3e60896b2178d1f [following]
--2023-05-16 19:57:03--  https://docker.io/library/postgres:12@sha256:0941dc788046d517b7c38f2cc26749346496b19d6233024ee3e60896b2178d1f
Connecting to docker.io (docker.io)|52.3.144.121|:443... connected.
Unable to establish SSL connection.
mbdocker@VM-MBDocker-S28:~/musicbrainz-docker$ 
yvanzo commented 1 year ago

This is definitely not just a Docker issue.

PeterCodar commented 1 year ago

My Ubuntu skills are very limited, so every help is very welcome.

PeterCodar commented 1 year ago

One very ugly workaround: Just try the same command sudo docker-compose build again and again and again. Approximately every 5th to 10th attempt you get reported back another IP address from registry-1.docker.io/v2 (which - if you are lucky - will not be resetted by peer).

In the meantime the build process seems to be completed.

Now I start executing the next commands from the installation instructions.

PeterCodar commented 1 year ago

It seems to work now after several executions of sudo docker-compose build (and using the pre-built search indexes based on the latest data dump).

If I start http://localhost:5000 I get a nice colorful GUI and also the needed API can be accessed from a workstation in the same IP subnet.

BTW: https doesn't return a result in the browser as mentioned in the installation instructions for web server

If set to 443 (https), then the port number will not appear either, but the a separate reverse proxy is required to handle https correctly.

The browser eventually shows something like this for unconfigured https:

The connection has timed out

An error occurred during a connection to localhost:5000.

The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer’s network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
yvanzo commented 1 year ago

Glad you worked around this network/VM issue. Closing as resolved.

Thanks for mentioning the HTTPS bit, the docs might be outdated, I will double-check that.