Docker nginx responds 403 if you are offline - docker

Im running docker with nginx, PHP and MariaDb in my company.
But if my laptop is offline or Im connected with vpn the nginx responds with an 403 error. Docker is starting normally. Do you have any idea why I get the 403 from nginx?
Maybe Its because of the mounted drives?
2018/06/05 13:23:20 [error] 5#5: *3 directory index of "/var/www/html/" is
forbidden, client: 172.21.0.1, server: _, request: "GET / HTTP/1.1", host:
"localhost"
172.21.0.1 - - [05/Jun/2018:13:23:20 +0000] "GET / HTTP/1.1" 403 572 "-"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/66.0.3359.139 Safari/537.36" "-"
Edit: I figured out that I cant mount the shared drives. I got an error that the firewall blocks it.

Related

docker containers: mariaDB connection issue with nextcloud

I'm the super user at my maschine. There is docker inside my volumne (/volume1/docker). I pulled the latest version of the images and run MariaDB, PhpMyAdmin and NextCloud:
docker run -d --name mariadb --network nextcloud --network-alias db -e MYSQL_ROOT_PASSWORD=r00tp#ss -e MYSQL_USER=nextcloud_rw -e MYSQL_PASSWORD=N3xtCl0ud! -e MYSQL_DATABASE=nextcloud -v /volume1/docker/mariadb:/var/lib/mysql --restart=unless-stopped mariadb:latest
docker run -d --name phpmyadmin --network nextcloud --link mariadb:db -e PMA_ARBITRARY=1 -e PMA_HOST=db -e PMA_USER=nextcloud_rw -e PMA_PASSWORD=N3xtCl0ud! -p 8082:80 --restart=unless-stopped phpmyadmin:latest
docker run -d --name nextcloud --network nextcloud -e MYSQL_HOST=db -e MYSQL_DATABASE=nextcloud -e MYSQL_USER=nextcloud_rw -e MYSQL_PASSWORD=N3xtCl0ud! -v /volume1/docker/nextcloud:/var/www/html -v db:/var/lib/mysql --restart=unless-stopped -p 8080:80 nextcloud:latest
When I open the browser and navigate to http:\\whereNextCloudLives:8080, I see the NextClud background plus the installation form. I enter the user nextcloud and the pw N3xtCl0ud! and get the response "Please check your mysql credentials. Cannot connect to DB".
MariaDB-Log:
[Note] mariadbd: ready for connections.
[Note] [Entrypoint]: Securing system users (equivalent to running mysql_secure_installation)
[Note] [Entrypoint]: Giving user nextcloud_rw access to schema nextcloud
[Note] [Entrypoint]: Creating user nextcloud_rw
[Note] [Entrypoint]: Creating database nextcloud
[Note] [Entrypoint]: Temporary server started.
stderr Version: '10.9.3-MariaDB-1:10.9.3+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 0 mariadb.org binary distribution
[Note] mariadbd: ready for connections.
[Warning] Access denied for user 'nextcloud_rw'#'172.18.0.4' (using password: YES)
[Warning] Access denied for user 'nextcloud_rw'#'172.18.0.4' (using password: YES)
[Warning] Access denied for user 'nextcloud_rw'#'172.18.0.4' (using password: YES)
stderr Version: '10.9.3-MariaDB-1:10.9.3+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
NextCloud-Log:
442381598Z stdout 172.18.0.1 - - [02/Dec/2022:18:26:11 +0000] "POST /index.php HTTP/1.1" 200 3538 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
2022-12-02T18:26:11.300610626Z stdout 127.0.0.1 - - [02/Dec/2022:18:26:11 +0000] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.54 (Debian) PHP/8.0.24 (internal dummy connection)"
2022-12-02T18:26:05.648774341Z stdout 172.18.0.1 - - [02/Dec/2022:18:26:04 +0000] "GET /dist/core-common.js.map?v=dc4002698c876c22453e HTTP/1.1" 200 4483569 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
2022-12-02T18:26:04.864831573Z stdout 172.18.0.1 - - [02/Dec/2022:18:26:04 +0000] "GET /dist/core-main.js.map?v=0a05117109bf8b6240ea HTTP/1.1" 200 106976 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
2022-12-02T18:26:04.845899731Z stdout 172.18.0.1 - - [02/Dec/2022:18:26:04 +0000] "GET /core/vendor/zxcvbn/dist/zxcvbn.js.map HTTP/1.1" 404 680 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
2022-12-02T18:26:04.844799000Z stdout 172.18.0.1 - - [02/Dec/2022:18:26:04 +0000] "GET /dist/core-install.js.map?v=ee580b4e58a4177adf85 HTTP/1.1" 200 9627 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
2022-12-02T18:26:04.331553336Z stdout 172.18.0.1 - - [02/Dec/2022:18:26:04 +0000] "GET /core/img/manifest.json HTTP/1.1" 200 728 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
2022-12-02T18:25:47.268364543Z stderr [Fri Dec 02 18:25:47.267810 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
2022-12-02T18:25:47.268255142Z stderr [Fri Dec 02 18:25:47.267778 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.0.24 configured -- resuming normal operations
2022-12-02T18:25:47.252431732Z stderr AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.4. Set the 'ServerName' directive globally to suppress this message
2022-12-02T18:25:47.240345812Z stderr AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.4. Set the 'ServerName' directive globally to suppress this message
I just use the IP. There is no domain configured. I've access to the DB with PhpMyAdmin.
Anyone with an idea what is wrong?

Swagger UI is blank or empty when i try t connect it to kong.yaml

This is the swagger of port 8099 swagger of 8099 then after i connect it to kong kong swagger the tab name is changing to Swagger UI that means its working but its empty. Any Solution?
//kong.yaml for swagger
_format_version: "2.1"
_transform: true
services:
# ------ Swagger port -------
- host: host.docker.internal
port: 8099
name: swagger-service
path: /swagger-ui/index.html
routes:
- name: swagger-service
paths:
- /swagger
strip_path: true
After i enter the port http://localhost:8000/swagger this will show
kong | 172.24.0.1 - - [24/May/2022:07:48:11 +0000] "GET /favicon-16x16.png HTTP/1.1" 404 48 "http://localhost:8000/swagger" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36 Edg/101.0.1210.53"

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

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
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
Try another image. I have a lot trouble using linuxserver image after few update. mariadb have official image on docker. Or maybe if you are want to still use linuxserver image, try another mariadb image version.

Ingress Nginx rules doesn't get followed always

I got 2 spring app pods deployed in k8 cluster. 1 replica each. Both have their cluster-ip services exposing the services.
/upstream/agentLabs/makeotherTierCall should forward to prevlab deployment /agentLabs/makeOtherTierCall
/downstream/basics/hello should forward to newlab deployment /basics/hello
I am using ingress-nginx to redirect the traffic with following rules.
ingress-service.yml
apiVersion: networking.k8s.io/v1
# UPDATE API
kind: Ingress
metadata:
namespace: javaspace
name: ingress-service
annotations:
kubernetes.io/ingress.class: 'nginx'
nginx.ingress.kubernetes.io/use-regex: 'true'
# ADD ANNOTATION
nginx.ingress.kubernetes.io/rewrite-target: /$1
# UPDATE ANNOTATION
spec:
rules:
- http:
paths:
- path: /upstream?(.*)
# UPDATE PATH
pathType: Prefix
# ADD PATHTYPE
backend:
service:
# UPDATE SERVICE FIELDS
name: prevlab-cluster-ip-service
port:
number: 8080
- path: /downstream?(.*)
# UPDATE PATH
pathType: Prefix
# ADD PATHTYPE
backend:
service:
# UPDATE SERVICE FIELDS
name: newlab-cluster-ip-service
port:
number: 8080
The issue is when I make any call (both 1 and 2) sometimes the ingress controller forwards the traffic correctly and sometimes it doesn't and I get 404. Basically, what I am observing is that alternatively the traffic is getting routed to both cluster-ip services one after the other.
for eg. if I make /upstream/agentLabs/makeotherTierCall request 2 times, at first it forwards wrongly to newlab cluster-ip service (giving back 404), and then next it forwards correctly to prevlab cluster-ip service (giving back 200).
ingress-nginx controller setup
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.1/deploy/static/provider/cloud/deploy.yaml
ingress-controller logs
192.168.65.3 - - [24/Sep/2021:10:04:21 +0000] "GET /upstream/agentLabs/makeOtherTierCall HTTP/2.0" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 45 0.008 [javaspace-prevlab-cluster-ip-service-8080] [] 10.1.0.181:8080 12 0.007 200 24ae53531ce4d7109004f81e79534ca4
192.168.65.3 - - [24/Sep/2021:10:04:21 +0000] "GET /upstream/agentLabs/makeOtherTierCall HTTP/2.0" 404 286 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 45 0.006 [javaspace-prevlab-cluster-ip-service-8080] [] 10.1.0.179:8080 286 0.005 404 1a32efb3a9dc21cce01b908afeb0248a
192.168.65.3 - - [24/Sep/2021:10:04:22 +0000] "GET /upstream/agentLabs/makeOtherTierCall HTTP/2.0" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 45 0.007 [javaspace-prevlab-cluster-ip-service-8080] [] 10.1.0.181:8080 12 0.007 200 542bd4abba25be5a416deca1152cb29b
192.168.65.3 - - [24/Sep/2021:10:04:22 +0000] "GET /upstream/agentLabs/makeOtherTierCall HTTP/2.0" 404 286 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 45 0.008 [javaspace-prevlab-cluster-ip-service-8080] [] 10.1.0.179:8080 286 0.007 404 aaea8e3bf60dab81ef7454d51863a22d
192.168.65.3 - - [24/Sep/2021:10:07:23 +0000] "GET /downstream/basics/hello HTTP/2.0" 404 306 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 35 0.009 [javaspace-newlab-cluster-ip-service-8080] [] 10.1.0.181:8080 306 0.009 404 178bd79cc71b73f7a337a2652322d65f
192.168.65.3 - - [24/Sep/2021:10:07:23 +0000] "GET /downstream/basics/hello HTTP/2.0" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 35 0.002 [javaspace-newlab-cluster-ip-service-8080] [] 10.1.0.179:8080 12 0.003 200 280d2b7974ae38a467237cc6cf437b98
192.168.65.3 - - [24/Sep/2021:10:07:24 +0000] "GET /downstream/basics/hello HTTP/2.0" 404 306 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 35 0.008 [javaspace-newlab-cluster-ip-service-8080] [] 10.1.0.181:8080 306 0.008 404 4e237232b4c53c9bb90e7bb59c15e916
192.168.65.3 - - [24/Sep/2021:10:07:24 +0000] "GET /downstream/basics/hello HTTP/2.0" 200 12 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" 35 0.003 [javaspace-newlab-cluster-ip-service-8080] [] 10.1.0.179:8080 12 0.002 200 be0cf532a972ec0d783e15869470f579
Using Docker Desktop's Kubernetes. Kubernetes 1.21.2
What am I doing wrong here? Is this default behavior? Do I need to do some additional config?
Nevermind. I had done a very small but very stupid mistake. In case someone comes wandering around here: I had used the same label for my 2 backend services. And for each of the cluster-IP services used the same selector. Hence, I was seeing inconsistent behavior.

I got problem while using Nginx to direct requests to services defined in docker-compose.yml

I'm setting up an app with multiple containers, and use nginx to redirect requests to correct container. However, I got stuck with the 502 Bad Gateway error.
Actually, the code is from a course on Udemy: Docker and Kubernetes.
I just copy and paste the code, it ran on instructor machine, but not mine. I tried on my windows and my macbook, restart docker, but still no hope. I looked for solutions on other stackoverflow posts, some other articles, but none of them tell me why it works on others' machines, but not mine.
Here is the repo of the code.
docker-compose.yml (full code):
version: "3"
services:
postgres:
...
redis:
...
nginx:
restart: always
build:
dockerfile: Dockerfile.dev
context: ./nginx
ports:
- "3050:80"
api:
...
client:
...
worker:
...
nginx/Dockerfile.dev
FROM nginx
COPY ./default.conf /etc/nginx/conf.d/default.conf
nginx/default.conf
upstream client {
server client:3000;
}
upstream api {
server api:5000;
}
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://client;
}
location /api {
rewrite /api/(.*) /$1 break;
proxy_pass http://api;
}
}
It runs just fine on instructor's machine and other learners', but not on my machines. I got error when connecting http://localhost:3050 and http://localhost:3050/api:
nginx_1 | 2019/07/08 02:52:35 [error] 6#6: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.25.0.1, server: , request: "GET / HTTP/1.1", upstream: "http://125.235.4.59:3000/", host: "localhost:3050"
nginx_1 | 172.25.0.1 - - [08/Jul/2019:02:52:35 +0000] "GET / HTTP/1.1" 502 559 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36" "-"
nginx_1 | 2019/07/08 02:52:57 [error] 6#6: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.25.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://125.235.4.59:3000/favicon.ico", host: "localhost:3050", referrer: "http://localhost:3050/"
nginx_1 | 172.25.0.1 - - [08/Jul/2019:02:52:57 +0000] "GET /favicon.ico HTTP/1.1" 502 559 "http://localhost:3050/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36" "-"
Any help is appreciated.
Needed to amend the docker-compose.yml:
the upstream services should expose their ports so that the nginx service can connect i.e.:
api:
expose:
- '5000'
client:
expose:
- '3000'
the nginx service depends_on the upstream services:
nginx:
depends_on:
- 'client'
- 'api'

Resources