Permission error in portainer logs after starting
- Dominant language
- Shell
- Stars
- 1.5k
- Forks
- 849
- PR merge metrics
- No merged PRs in 30d
Description
Hello, so the portianer logs show following:
```
Error: mkdir failed for '/var/run/kong/logs': Permission denied (code 13)
Run with --v (verbose) or --vv (debug) for more details
```
I checkd if the folder exist which was not the case so i created the folder and added chmod permission 777 to it, sadly the issue keeps being the same. I also slightly modified the compose file because i dont want to have it exposed on public ips, instead it should only run internally and then i make use of nginx proxy manager to connect it to a domain in order to access it outside of the vps.
Here the docker-compose.yml file i use as a portainer stack:
```yml
version: '3.0'
x-kong-config:
&kong-env
KONG_DATABASE: ${KONG_DATABASE:-off}
KONG_PG_DATABASE: ${KONG_PG_DATABASE:-kong}
KONG_PG_HOST: db
KONG_PG_USER: ${KONG_PG_USER:-kong}
KONG_PG_PASSWORD_FILE: /run/secrets/kong_postgres_password
services:
kong-migrations:
image: "${KONG_DOCKER_TAG:-kong:latest}"
command: kong migrations bootstrap
profiles: [ "database" ]
depends_on:
- db
environment:
<<: *kong-env
secrets:
- kong_postgres_password
networks:
webproxy:
ipv4_address: 172.26.0.18
restart: on-failure
kong-migrations-up:
image: "${KONG_DOCKER_TAG:-kong:latest}"
command: kong migrations up && kong migrations finish
profiles: [ "database" ]
depends_on:
- db
environment:
<<: *kong-env
secrets:
- kong_postgres_password
networks:
webproxy:
ipv4_address: 172.26.0.19
restart: on-failure
kong:
image: "${KONG_DOCKER_TAG:-kong:latest}"
user: "${KONG_USER:-kong}"
environment:
<<: *kong-env
KONG_ADMIN_ACCESS_LOG: /dev/stdout
KONG_ADMIN_ERROR_LOG: /dev/stderr
KONG_PROXY_LISTEN: "${KONG_PROXY_LISTEN:-0.0.0.0:8000}"
KONG_ADMIN_LISTEN: "${KONG_ADMIN_LISTEN:-0.0.0.0:8001}"
KONG_ADMIN_GUI_LISTEN: "${KONG_ADMIN_GUI_LISTEN:-0.0.0.0:8002}"
KONG_PROXY_ACCESS_LOG: /dev/stdout
KONG_PROXY_ERROR_LOG: /dev/stderr
KONG_PREFIX: ${KONG_PREFIX:-/var/run/kong}
KONG_DECLARATIVE_CONFIG: "/opt/kong/kong.yaml"
secrets:
- kong_postgres_password
networks:
webproxy:
ipv4_address: 172.26.0.17
#ports:
#- "172.26.0.17:8000:8000/tcp"
#- "172.26.0.17:8443:8443/tcp"
#- "127.0.0.18:8001:8001/tcp"
#- "127.0.0.18:8444:8444/tcp"
#- "127.0.0.18:8002:8002/tcp"
healthcheck:
test: [ "CMD", "kong", "health" ]
interval: 10s
timeout: 10s
retries: 10
restart: on-failure:5
read_only: true
volumes:
- prefix_vol:${KONG_PREFIX:-/var/run/kong}
- tmp_vol:/tmp
- ./config:/opt/kong
security_opt:
- no-new-privileges
db:
image: postgres:latest
profiles: [ "database" ]
environment:
POSTGRES_DB: ${KONG_PG_DATABASE:-kong}
POSTGRES_USER: ${KONG_PG_USER:-kong}
POSTGRES_PASSWORD_FILE: /run/secrets/kong_postgres_password
secrets:
- kong_postgres_password
healthcheck:
test:
[
"CMD",
"pg_isready",
"-d",
"${KONG_PG_DATABASE:-kong}",
"-U",
"${KONG_PG_USER:-kong}"
]
interval: 30s
timeout: 30s
retries: 3
restart: on-failure
stdin_open: true
tty: true
networks:
webproxy:
ipv4_address: 172.26.0.205
volumes:
- pgdata:/var/lib/postgresql/data
networks:
webproxy:
external: true
secrets:
kong_postgres_password:
file: /run/secrets/./kong_postgres_password
volumes:
pgdata:
prefix_vol:
tmp_vol:
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the supplied docker-compose.yml, especially the kong service's user, read_only setting, KONG_PREFIX, and prefix_vol mount. Reproduce the startup and inspect the reported /var/run/kong/logs permission error; done means the cause is confirmed and Kong starts without that error under the reported deployment setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, docker-compose, postgres
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100