No domain on Raspberry Pi 4 with docker

Hello,

Can you please help me to create a simple reverse proxy configuration for Raspberry Pi 4 with Docker? At first I tried to set up a pihole with Traefik, with some information from the net. Then I tried a simpler configuration to understand how Traefik works, but I could not find a solution.

I do not have a domain, but as far as I know, Traefik does not need any.

This is my docker-compose.yml file:

version: "3"

services:
  traefik:
    image: traefik:latest
    ports:
      - '80:80'
      - '443:443'
      - '8080:8080'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks: 
      - traefik-net
  whoami:
    image: emilevauge/whoami
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=Host:home.local;PathPrefixStrip:/traefik;PathPrefix:/testpath
      - traefil.docker.network=traefik-netl
      - traefik.port=80
    networks: 
      - traefik-net

networks:
    traefik-net: {}

I got the error message: 404 page not found on ip http://[ip-address]/testpath or whoami was stopped.
Docker log error: standard_init_linux.go:211: exec user process caused "exec format error"

Any ideas?

cheers Twinsen

Docker version
Server Version: 18.09.0
traefik:latest
emilevauge/whoami:latest

Hello,

traefik.frontend.rule=Host:home.local;PathPrefixStrip:/traefik;PathPrefix:/testpath

The previous label is a Traefik v1 label.

so you have to replace:

image: traefik:latest

by

image: traefik:v1.7

or use Traefik v2 configuration.

In any case, I recommend not to use latest but an explicit version.

Hi,

I changed the image version to v1.7, as you suggested, to keep it simple.I just want to get any configuration up and running. It does not have to be whoami.

image: traefik:v1.7

I expected that whoami should then be accessible via the ip address http://192.168.x.x/whoami, but it is not. Please note on the Raspberry Pi 4 is no graphic user interface installed. I found that the whoami container was stopped. Can you please give me another hint?

cheers Twinsen

version: "3"

services:
  traefik:
    image: traefik:v1.7
    ports:
      - '80:80'
      - '443:443'
      - '8080:8080'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks: 
      - traefik-net
  whoami:
    image: containous/whoami:v1.3.0
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=PathPrefix:/whoami
      - traefil.docker.network=traefik-net
      - traefik.port=80
    networks: 
      - traefik-net

networks:
    traefik-net: {}

Hi,

Thank you for the file, but it is still not working. I checked the docker logs file from whoami, because it was not running after sudo docker-compose up -d. According to docker the container whoami is not running continual. The container was stopped and the docker log from whoami shows:

standard_init_linux.go:211: exec user process caused "exec format error"

I think this why I got an 404 page not found error on http://192.168.x.x/whoami.

cheers Twinsen

version: "3"

services:
  traefik:
    image: traefik:v1.7.18
    command:
    - --docker=true
    - --docker.exposedbydefault=false
    ports:
      - '80:80'
      - '443:443'
      - '8080:8080'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks: 
      - traefik-net
  whoami:
    image: containous/whoami:v1.3.0
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=PathPrefix:/whoami
      - traefil.docker.network=traefik-net
      - traefik.port=80
    networks: 
      - traefik-net

networks:
    traefik-net: {}

Hi,

Thank you for the new file. Unfortunately whoami was automatically exited, 2 seconds after start:

$ sudo docker ps -a
CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS                      PORTS                                                              NAMES
126fa24f4ed4        traefik:v1.7.18            "/traefik --docker=t…"   35 seconds ago      Up 33 seconds               0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:8080->8080/tcp   traefik_traefik_1
c4bbf11d2ab8        containous/whoami:v1.3.0   "/whoami"                35 seconds ago      Exited (1) 33 seconds ago

I replaced whoami with nginx for further testing, who is running stable:

version: "3"

services:
  traefik:
    image: traefik:v1.7.18
    command:
    - --docker=true
    - --docker.exposedbydefault=false
    ports:
      - '80:80'
      - '443:443'
      - '8080:8080'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks: 
      - traefik-net
  nginx: 
    image: nginx:latest
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=PathPrefix:/nginx
      - traefil.docker.network=traefik-net
      - traefik.port=80
    networks: 
      - traefik-net

networks:
    traefik-net: {}

I still get the 404 not found error on http://192.168.x.55/nginx. Here is the log file. I hope that helps:

$ sudo docker-compose up
Creating network "traefik_traefik-net" with the default driver
Creating traefik_traefik_1 ... done
Creating traefik_nginx_1   ... done
Attaching to traefik_nginx_1, traefik_traefik_1
nginx_1    | 192.168.224.2 - - [06/Oct/2019:15:12:53 +0000] "GET /nginx HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" "192.168.x.55"
nginx_1    | 2019/10/06 15:12:53 [error] 6#6: *1 open() "/usr/share/nginx/html/nginx" failed (2: No such file or directory), client: 192.168.224.2, server: localhost, request: "GET /nginx HTTP/1.1", host: "192.168.x.77"

With

    ports:
      - 83:80

I can, as expected access the nginx server directly but not with Traefik. What is the problem?

cheers Twinsen

The image containous/whoami is for amd64.

As you are using a Pi4, your arch is arm64, so it's normal that whoami cannot run.

Edit: I just released a new version, now (from v1.4.0) containous/whoami is supported on ARM.

Hello,

I see, but the Traefik reverse proxy is still not working. Why is that?

cheers Twinsen

I just released a new version, now (from v1.4.0) containous/whoami is supported on ARM.

So could you try:

version: "3"

services:
  traefik:
    image: traefik:v1.7.18
    command:
    - --docker=true
    - --docker.exposedbydefault=false
    ports:
      - '80:80'
      - '443:443'
      - '8080:8080'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks: 
      - traefik-net

  whoami:
    image: containous/whoami:v1.4.0
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=PathPrefix:/whoami
      - traefil.docker.network=traefik-net
      - traefik.port=80
    networks: 
      - traefik-net

networks:
    traefik-net: {}

Also the following example works for me on Linux amd64:

version: "3"

services:
  traefik:
    image: traefik:v1.7.18
    command:
    - --docker=true
    - --docker.exposedbydefault=false
    ports:
      - '80:80'
      - '443:443'
      - '8080:8080'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks: 
      - traefik-net

  whoami:
    image: containous/whoami:v1.4.0
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=PathPrefix:/whoami
      - traefil.docker.network=traefik-net
      - traefik.port=80
    networks: 
      - traefik-net

  nginx: 
    image: nginx:latest
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=PathPrefix:/nginx
      - traefil.docker.network=traefik-net
      - traefik.port=80
    networks: 
      - traefik-net

networks:
    traefik-net: {}
$ curl localhost/nginx
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.17.4</center>
</body>
</html>
$ curl localhost/whoami
Hostname: 9041cf2a947d
IP: 127.0.0.1
IP: 172.21.0.2
RemoteAddr: 172.21.0.4:54242
GET /whoami HTTP/1.1
Host: localhost
User-Agent: curl/7.65.3
Accept: */*
Accept-Encoding: gzip
X-Forwarded-For: 172.21.0.1
X-Forwarded-Host: localhost
X-Forwarded-Port: 80
X-Forwarded-Proto: http
X-Forwarded-Server: eae1687db14b
X-Real-Ip: 172.21.0.1
1 Like

Hi Idez,

Thank you so much for the new release from whoami. I don't have time for further tests in the moment, but I would like you to know, that Traefik answered correct for the first time on 192.168.x.x/whoami. I'm so glad that it is finally working.

cheers Twinsen

Note that there is a typo in the labels section.

  • traefil.docker.network=

Hello....Raspbian has the favorable position that it is the OS suggested by Raspberry Pi, and is the one that gets bug fixes and Pi-explicit highlights before some other. (The exemption some of the time being LibreELEC for some media highlights). The 64 bit for Raspbian won't get you a 64-bit userland. There is a systemd-nspawn 64-bit userland which you can use on Raspbian with a 64-digit portion. On the off chance that you need a genuine 64-cycle userland, at that point Ubuntu would presumably be my pick.