0

Raspberry Pi 4 Raspberry Pi OS Lite Docker 23.0.0

Docker containers are not accessible in the browser after reboot, I thought it may have been because the containers do not start, but it appears that they do. But I am not sure why they are inaccessible. As an attempted remedy, I ran the following commands:

docker run -d --restart always [Container] 

or just:

docker start [Container]

The only solution I can seem to find is to reinstall the container, but that is useless because I lose data and have to set up the application again, after every reboot.

Here's what I've done:

I first checked the running containers:

pi@raspberrypi4:~ $ docker ps
CONTAINER ID   IMAGE                    COMMAND                  CREATED         STATUS              PORTS                                       NAMES
cea07c9a5d01   searxng/searxng          "/sbin/tini -- /usr/…"   2 minutes ago   Up About a minute   8080/tcp                                   elegant_bhabha

Focussing on the searxng you can see it is running:

cea07c9a5d01 searxng/searxng "/sbin/tini -- /usr/…" 2 minutes ago Up About a minute 8080/tcp

Then I try to restart Searxng just to see if it will make it work in the browser:

pi@raspberrypi4:~ $ docker restart elegant_bhabha
elegant_bhabha

I proceed to check to see if Searxng has started and is accessible at 192.168.50.168:8080 in the browser, it is not.

pi@raspberrypi4:~ $ docker ps
CONTAINER ID   IMAGE                    COMMAND                  CREATED         STATUS         PORTS                                       NAMES
cea07c9a5d01   searxng/searxng          "/sbin/tini -- /usr/…"   3 minutes ago   Up 2 minutes   8080/tcp                                   elegant_bhabha

Then I re-do the installation process to get it to work:

pi@raspberrypi4:~ $ cd my-instance
pi@raspberrypi4:~/my-instance $ export PORT=8080
pi@raspberrypi4:~/my-instance $ docker pull searxng/searxng
Using default tag: latest
latest: Pulling from searxng/searxng
Digest: sha256:3d656c623ce5293633e4e0d7fcf4bc47e17dc4dc13d4300173b57b0d73879270
Status: Image is up to date for searxng/searxng:latest
docker.io/searxng/searxng:latest
pi@raspberrypi4:~/my-instance $ docker run --rm \
             -d -p ${PORT}:8080 \
             -v "${PWD}/searxng:/etc/searxng" \
             -e "BASE_URL=http://localhost:$PORT/" \
             -e "INSTANCE_NAME=my-instance" \
             searxng/searxng
8b914f2122817a3f301fa0b550ccc600426728fe30098ae845d950547f1fa9b0

As you can see below, there is a change after reinstalling the container, after reinstallation the container is now accessible in the browser at 192.168.50.168:8080, but of course I have to again set up the application. I have to do this for every docker container I install after every reboot.

pi@raspberrypi4:~/my-instance $ docker ps
CONTAINER ID   IMAGE                    COMMAND                  CREATED          STATUS          PORTS                                       NAMES
8b914f212281   searxng/searxng          "/sbin/tini -- /usr/…"   15 seconds ago   Up 12 seconds   0.0.0.0:8080->8080/tcp, :::8080->8080/tcp   gifted_gagarin
cea07c9a5d01   searxng/searxng          "/sbin/tini -- /usr/…"   7 minutes ago    Up 6 minutes    8080/tcp                                  elegant_bhabha

Every time I install any container, it works fine and is accessible in the browser. And then after reboot they don't work, and running restart commands doesn't work. I have no idea how to resolve this, any ideas?

Yeah Nah
  • 25
  • 4
  • @goldilocks Is it okay to take a look at my edited post again, and again sorry for making it difficult in my original post. – Yeah Nah Feb 05 '23 at 05:07
  • the difference in PORTS property is interesting – Jaromanda X Feb 05 '23 at 09:56
  • I don't think you are going to get much help here with this. It is almost certainly something to do with the port mapping from the container, which involves a virtual interface; you don't seem to have thought about this at all, I think you should be looking at the ip NAT table, etc. However, I haven't used docker in years (I converted to LXC), and no one else here has chimed in. Also, the brand of hardware is irrelevant. You should ask further about this on Unix & Linux, ServerFault or Super User. – goldilocks Feb 05 '23 at 14:29
  • Thanks. I haven't thought about what you mentioned because I am a beginner with Linux and Terminal in general. I don't even understand what you wrote, so I'll google some of it and look for help elsewhere. – Yeah Nah Feb 05 '23 at 15:01

0 Answers0