Home > Net >  Can't access docker container via host browser. Ping is allowed
Can't access docker container via host browser. Ping is allowed

Time:10-25

I created first time some containers via docker-compose in the same new network. After while the env is completed. I see running containers via docker ps. Normally after that i can use containers. But when I tried to access wordpress web page from host via localhost:20000 or :20000. I get ERR_Connection refused. I was expecting info about "Error connecnting to the database".I can ping the containers by docker containers ip from the host. So maybe someone know how to fix that and get access to them.

This happens with this new network - network_1. Other containers like pihole portainer in default bridge network are accessible from whole host network. Thank You.

version: '3'

services:
  # Database
  db:
    image: linuxserver/mariadb
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    ports:
      - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: wordpress
      MYSQL_USER: user
      MYSQL_PASSWORD: password
    networks:
      - network_1
  # phpmyadmin
  phpmyadmin:
    depends_on:
      - db
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - 3308:80
    environment:
      PMA_HOST: 1
      MYSQL_ROOT_PASSWORD: password
    networks:
      - network_1
  # Wordpress
  wordpress:
    depends_on:
      - db
    image: wordpress:latest
    ports:
      - 20000:80
    restart: always
    volumes: ['./:/var/www/html']
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: user
      WORDPRESS_DB_PASSWORD: password
    networks:
      - network_1
  # Nextcloud    
  nextcloud:
    image: nextcloud
    restart: always
    ports:
      - 30000:80
    depends_on:
      - db
    volumes:
      - nextcloud:/var/www/html
    environment:
      MYSQL_PASSWORD: password
      MYSQL_DATABASE: nextcloud
      MYSQL_USER: user
      MYSQL_HOST: db:3306
    networks:
      - network_1      
networks:
  network_1:
volumes:
  db_data:
  nextcloud:

Some commands from docker:

    pi@raspberrypi:~ $ docker ps
CONTAINER ID   IMAGE                           COMMAND                  CREATED       STATUS                   PORTS
                              NAMES
52d11a5c2931   wordpress:latest                "docker-entrypoint.s…"   2 hours ago   Up 2 hours               0.0.0.0:20000->80/tcp, :::20000->80/tcp
                              dom_wordpress_1
39feec5309d3   phpmyadmin/phpmyadmin           "/docker-entrypoint.…"   2 hours ago   Up 2 minutes             0.0.0.0:3308->80/tcp, :::3308->80/tcp
                              dom_phpmyadmin_1
62a943db01f2   nextcloud                       "/entrypoint.sh apac…"   2 hours ago   Up 2 hours               0.0.0.0:30000->80/tcp, :::30000->80/tcp
                              dom_nextcloud_1
0681159165df   linuxserver/mariadb             "/init"                  2 hours ago   Up 2 hours               3306/tcp
                              dom_db_1
d0b6ece5c5aa   portainer/portainer-ce:latest   "/portainer"             4 hours ago   Up 4 hours               0.0.0.0:9000->9000/tcp, :::9000->9000/tcp, 8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp
                              portainer
71ee89deb6de   nginx:latest                    "/docker-entrypoint.…"   12 days ago   Up 4 hours               0.0.0.0:80->80/tcp, :::80->80/tcp
                              nginx
03fcbea93e14   pihole/pihole:latest            "/s6-init"               5 weeks ago   Up 4 hours (unhealthy)   0.0.0.0:53->53/tcp, 0.0.0.0:53->53/udp, :::53->53/tcp, :::53->53/udp, 67/udp, 0.0.0.0:5000->80/tcp, :::5000->80/tcp, 0.0.0.0:5001->443/tcp, :::5001->443/tcp   pihole

And docker inspect. !-No output for dom_db_1 and dom_phpmyadmin_1, and running pihole

pi@raspberrypi:~/docker-compose-Templates/dom $ docker port dom_db_1
pi@raspberrypi:~/docker-compose-Templates/dom $ docker port pihole
443/tcp -> 0.0.0.0:5001
443/tcp -> :::5001
53/tcp -> 0.0.0.0:53
53/tcp -> :::53
53/udp -> 0.0.0.0:53
53/udp -> :::53
80/tcp -> 0.0.0.0:5000
80/tcp -> :::5000

Logs from container wordpress(after rebuild-new ID) - it's working but VERY slow... In bridge network wordpress worked normally.

    AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.5. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.5. Set the 'ServerName' directive globally to suppress this message
[Fri Oct 22 13:36:25.354493 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.48 (Debian) PHP/7.4.23 configured -- resuming normal operations
[Fri Oct 22 13:36:25.354772 2021] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
192.168.1.201 - - [22/Oct/2021:13:36:25  0000] "GET / HTTP/1.1" 500 2834 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:00:21  0000] "GET / HTTP/1.1" 302 408 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:01:13  0000] "-" 408 0 "-" "-"
192.168.1.201 - - [22/Oct/2021:14:02:25  0000] "GET / HTTP/1.1" 302 408 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:00:40  0000] "GET /wp-admin/install.php HTTP/1.1" 200 2816 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:46  0000] "GET /wp-includes/css/buttons.min.css?ver=5.8 HTTP/1.1" 200 1791 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:45  0000] "GET /wp-includes/css/dashicons.min.css?ver=5.8 HTTP/1.1" 200 36068 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:46  0000] "GET /wp-admin/css/forms.min.css?ver=5.8 HTTP/1.1" 200 6546 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:48  0000] "GET /wp-admin/css/l10n.min.css?ver=5.8 HTTP/1.1" 200 1021 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:48  0000] "GET /wp-admin/css/install.min.css?ver=5.8 HTTP/1.1" 200 2129 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:54  0000] "GET /wp-includes/js/zxcvbn-async.min.js?ver=1.0 HTTP/1.1" 200 605 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:51  0000] "GET /wp-includes/js/jquery/jquery-migrate.min.js?ver=3.3.2 HTTP/1.1" 200 4520 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:49  0000] "GET /wp-includes/js/jquery/jquery.min.js?ver=3.6.0 HTTP/1.1" 200 31261 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:55  0000] "GET /wp-admin/images/wordpress-logo.svg?ver=20131107 HTTP/1.1" 200 1810 "http://raspberrypi:20000/wp-admin/css/install.min.css?ver=5.8" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:00  0000] "GET /wp-includes/js/dist/hooks.min.js?ver=a7edae857aab69d69fa10d5aef23a5de HTTP/1.1" 200 2141 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:01  0000] "GET /wp-includes/js/dist/i18n.min.js?ver=5f1269854226b4dd90450db411a12b79 HTTP/1.1" 200 4209 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:56  0000] "GET /wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=3.15.0 HTTP/1.1" 200 6382 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:13:56  0000] "GET /wp-includes/js/dist/vendor/regenerator-runtime.min.js?ver=0.13.7 HTTP/1.1" 200 2749 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:02  0000] "GET /wp-admin/js/password-strength-meter.min.js?ver=5.8 HTTP/1.1" 200 970 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:02  0000] "GET /wp-includes/js/underscore.min.js?ver=1.8.3 HTTP/1.1" 200 7670 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:02  0000] "GET /wp-includes/js/wp-util.min.js?ver=5.8 HTTP/1.1" 200 1054 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:04  0000] "GET /wp-admin/js/user-profile.min.js?ver=5.8 HTTP/1.1" 200 2637 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:05  0000] "GET /favicon.ico HTTP/1.1" 302 407 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:06  0000] "GET /wp-admin/install.php HTTP/1.1" 200 2815 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:14:05  0000] "GET /wp-includes/js/zxcvbn.min.js HTTP/1.1" 200 400400 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:26:39  0000] "-" 408 0 "-" "-"
172.18.0.1 - - [22/Oct/2021:14:26:53  0000] "GET / HTTP/1.1" 500 2834 "-" "Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.98 Safari/537.36"
172.18.0.1 - - [22/Oct/2021:14:27:28  0000] "GET /favicon.ico HTTP/1.1" 500 2834 "http://localhost:20000/" "Mozilla/5.0 (X11; CrOS aarch64 13597.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.98 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:25:48  0000] "POST /wp-admin/install.php?step=2 HTTP/1.1" 200 1789 "http://raspberrypi:20000/wp-admin/install.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:47:22  0000] "GET /favicon.ico HTTP/1.1" 404 492 "http://raspberrypi:20000/wp-admin/install.php?step=2" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
192.168.1.201 - - [22/Oct/2021:14:50:43  0000] "-" 408 0 "-" "-"
192.168.1.201 - - [22/Oct/2021:14:49:51  0000] "GET /wp-login.php HTTP/1.1" 200 2539 "http://raspberrypi:20000/wp-admin/install.php?step=2" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"

Logs from phpmyadmin(id may be changed after my actions)

pi@raspberrypi:~ $ docker container logs e569effa480c
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error
standard_init_linux.go:228: exec user process caused: exec format error

CodePudding user response:

I think

  # Database
  db:
    image: linuxserver/mariadb
    volumes:
      - db_data:/var/lib/mysql
    restart: always
        ports:
      - 3306:3306

should be

  # Database
  db:
    image: linuxserver/mariadb
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    ports:
      - 3306:3306

CodePudding user response:

All the answers abowe were helpful. After restarting RPI and waiting some time docker logs moved, and nextcloud service with others have run. Thanks.

  • Related