nextcloud can't create an admin user - docker

error while trying to create the admin user:
Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user 'nextcloud'#'172.22.0.6' (using password: YES)
docker-compose.yml
version: '3'
volumes:
nextcloud-data:
nextcloud-db:
networks:
nginx_network:
external: true
services:
app:
image: nextcloud
restart: always
volumes:
- nextcloud-data:/var/www/html
environment:
- MYSQL_PASSWORD=test
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
networks:
- nginx_network
db:
image: mariadb
restart: always
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- nextcloud-db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=test
- MYSQL_PASSWORD=test
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
networks:
- nginx_network
I couldn't find any similar problems with a solution that works for me and the docker compose seems okay to me

Solution that worked for me:
changed database container's name
deleted all the volumes
DO NOT SET THE USER AS ROOT normal user is enough
(also this error shows up if you mistype your credentials between containers)

Related

Error while trying to run docker-compose up [duplicate]

This question already has answers here:
How to fix docker: Got permission denied issue
(33 answers)
Closed 9 months ago.
Docker-compose.yml file:
version: "3"
services:
terrad:
image: terramoney/localterra-core:bombay
pull_policy: always
volumes:
- ./config:/root/.terra/config
networks:
- terra
ports:
- "26657:26657"
- "1317:1317"
- "9090:9090"
- "9091:9091"
command: terrad start
oracle:
image: terramoney/pseudo-feeder:bombay
pull_policy: always
depends_on:
- terrad
networks:
- terra
environment:
TESTNET_LCD_URL: http://terrad:1317
command: start
postgres:
image: postgres:12
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- terra
environment:
POSTGRES_USER: dev
POSTGRES_PASSWORD: dev
# redis:
# image: redis:latest
# networks:
# - terra
# ports:
# - "6379:6379"
fcd-collector:
image: terramoney/fcd:1.0.0-beta.2
depends_on:
- terrad
- postgres
volumes:
- ./logs:/app/logs
networks:
- terra
env_file: fcd.env
command: collector
restart: unless-stopped
fcd-api:
image: terramoney/fcd:1.0.0-beta.2
depends_on:
- terrad
- postgres
volumes:
- ./logs:/app/logs
networks:
- terra
ports:
- 3060:3060
env_file: fcd.env
command: start
networks:
terra:
driver: bridge
when trying to run docker-compose up I am facing this error:
My docker-compose version is 2.1.1
I got this error
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json?all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.project%3Dlocalterra%22%3Atrue%7D%7D&limit=0": dial unix /var/run/docker.sock: connect: permission denied
You have set pull_policy to false. The allowed values are always, never, missing or build. You can also keep it empty.
Docs are here.

Why is my app not installed? File not found

This is my docker-compose.yml. I am trying to deploy app and mysql,I added network.
version: '3'
services:
#PHP Service
app:
image: lscr.io/linuxserver/bookstack
container_name: bookstack
restart: unless-stopped
environment:
- DB_HOST=mysql
- DB_USER=quantox
- DB_PASS=****
- DB_DATABASE=bookstackapp
working_dir: /var/www
volumes:
- ./:/var/www
- ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
ports:
- 6875:80
networks:
- app-network
db:
image: mysql:5.7.22
container_name: mysql
restart: unless-stopped
ports:
- 33060:3306
environment:
- MYSQL_ROOT_PASSWORD=***
- TZ=Europe/Budapest
- MYSQL_DATABASE=bookstackapp
- MYSQL_USER=bookstack
- MYSQL_PASSWORD=****
volumes:
- dbdata:/var/lib/mysql/
- ./mysql/my.cnf:/etc/mysql/my.cnf
networks:
- app-network
#Docker Networks
networks:
app-network:
driver: bridge
#Volumes
volumes:
dbdata:
driver: local
After I go for up -d
I got
Name Command State Ports
-----------------------------------------------------------------------------------------------
bookstack /init Up 443/tcp, 0.0.0.0:6875->80/tcp,:::6875->80/tcp
mysql docker-entrypoint.sh mysqld Up 0.0.0.0:33060->3306/tcp,:::33060->3306/tcp
But in browser localhost:6875 shows
File not found.
Why? Both my app and mysql are on same network. What should I check now?
When using volumes (-v flags) permissions issues can arise between the host OS and the container, you could avoid this issue by allowing you to specify the user PUID and group PGID.

Clair V4 installation errors

Can someone help me setting up clair with a docker image which is relatively same as
git#github.com:Charlie-belmer/Docker-security-example.git
version: '2.1'
services:
postgres:
image: postgres:12
restart: unless-stopped
volumes:
- ./docker-utils/postgres-data/:/var/lib/postgresql/data:rw
environment:
- POSTGRES_PASSWORD=ChangeMe
- POSTGRES_USER=clair
- POSTGRES_DB=clair
clair:
image: quay.io/coreos/clair:v4.3.4
restart: unless-stopped
volumes:
- ./docker-utils/clair-config/:/config/:ro
- ./docker-utils/clair-tmp/:/tmp/:rw
depends_on:
postgres:
condition: service_started
command: [-conf, /config/config.yml]
user: root
clairctl:
image: jgsqware/clairctl:latest
restart: unless-stopped
environment:
- DOCKER_API_VERSION=1.41
volumes:
- ./docker-utils/clairctl-reports/:/reports/:rw
- /var/run/docker.sock:/var/run/docker.sock:ro
depends_on:
clair:
condition: service_started
user: root
error i am getting is
2022/02/25 04:20:33 failed to validate config: indexer mode requires a database connection string
It works perfectly with clair's 2.0.6 (https://github.com/Charlie-belmer/Docker-security-example/blob/master/clair/docker-compose.yml).
How exactly I should find out what is the problem ? Clair's github is useless since they do not provide me a single docker file for my CI/CD. Any help would be appreciated.

dockered mariadb "[1045] Access denied for user" inside docker network

I know that this question has a lot answers on stackoverflow but I didn't found a solution for my case!
I moving the Laravel app to the containers.
I CAN CONNECT TO MARIADB INSTANCE OUTSIDE THE DOCKER NETWORK BUT NOT INSIDE!
(I can connect via MySQL Workbench, locally (via docker exec), I can restore the dump locally from container console and access to DB data outside)
What's wrong?
Why the app is not working (PHP has no access to the mariadb via internal app_network) but in the same time I can get access to DB outside and inside container itself???
OS: CentOS 7.9.2009
Docker: 20.10.12 (e91ed57)
Docker-compose: 1.29.2 (5becea4c)
The same configs works fine on Windows 10.
DOCKER COMPOSE CONFIG:
version: '3.9'
networks:
app_network:
driver: bridge
name: ${NETWORK_NAME}
volumes:
app:
name: ${APP_VOLUME_NAME}
mysql_database:
name: ${MYSQL_DATABASE_VOLUME_NAME}
mysql_dumps:
name: ${MYSQL_DATABASE_DUMPS_VOLUME_NAME}
services:
mariadb:
image: mariadb
env_file:
- ./.env
command: --default-authentication-plugin=mysql_native_password
ports:
- ${MYSQL_EXTERNAL_PORT}:3306
volumes:
- mysql_database:/var/lib/mysql
- mysql_dumps:/var/mysqldump
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
networks:
app_network:
aliases:
- mariadb
profiles:
- dev
- prod
php:
restart: always
env_file:
- ./.env
build:
context: ../../
dockerfile: ./.environment/cs/php/Dockerfile
args:
- USER_ID=${PHP_USER_ID}
- GROUP_ID=${PHP_GROUP_ID}
- DEFAULT_CONFIG_FILE=${PHP_DEFAULT_CONFIG_FILE}
- CUSTOM_CONFIG_FILE=${PHP_CUSTOM_CONFIG_FILE}
- PROJECT_FOLDER=${PHP_PROJECT_FOLDER}
volumes:
- ./php/logs:/var/log
- ../../:${PHP_PROJECT_FOLDER}
networks:
app_network:
aliases:
- php
depends_on:
- memcached
- mariadb
profiles:
- dev
- prod
nginx:
restart: always
env_file:
- ./.env
build:
context: ../../
dockerfile: ./.environment/cs/nginx/Dockerfile
args:
- CONFIG_FILE=${WEB_CONFIG_FILE}
- PROJECT_FOLDER=${WEB_PROJECT_FOLDER}
ports:
- ${WEB_EXTERNAL_PORT}:80
volumes:
- ./nginx/logs:/var/log/nginx
- ../../public:${WEB_PROJECT_FOLDER}:cached
networks:
app_network:
aliases:
- nginx
depends_on:
- php
profiles:
- dev
- prod
Docker .ENV
NETWORK_NAME=CS
APP_VOLUME_NAME=CS_APP_STORAGE
MYSQL_DATABASE_VOLUME_NAME=CS_DATABASE
MYSQL_DATABASE_DUMPS_VOLUME_NAME=CS_DATABASE_DUMPS
MYSQL_EXTERNAL_PORT=3317
MYSQL_ROOT_PASSWORD=root
MYSQL_USER=client
MYSQL_PASSWORD=client
PHP_USER_ID=1000
PHP_GROUP_ID=1000
PHP_DEFAULT_CONFIG_FILE=php.ini-production
PHP_CUSTOM_CONFIG_FILE=./.environment/cs/php/custom.prod.ini
PHP_PROJECT_FOLDER=/var/www/app
WEB_EXTERNAL_PORT=127.0.0.1:8091
WEB_CONFIG_FILE=./.environment/cs/nginx/nginx.dev.conf
WEB_PROJECT_FOLDER=/var/www/app/public
Laravel .ENV
DB_CONNECTION=mysql
DB_HOST=mariadb
DB_PORT=3306
DB_DATABASE=client
DB_USERNAME=client
DB_PASSWORD=client
try to add the expose config key in the maria db service
mariadb:
//...
expose:
- 3306
This is the issue of the MariaDB container. I connected to the MariaDB via MySQL Workbench, fully remove the user, create a new one and give scheme privileges.
After that all works fine.

error Database connection failure: could not translate host name "db" to address: Temporary failure in name resolution in docker container

hay, i have docker-compose and install container for odoo 12, this is my docker-compose.yaml file
version: '3.3'
services:
odoo12:
image: odoo:12.0
container_name: odoo12
restart: unless-stopped
depends_on:
- db12-odoo
ports:
- 8013:8069
volumes:
- odoo12-web-data:/var/lib/odoo
- ./etc:/etc/odoo
- ./addons:/mnt/extra-addons
db12-odoo:
image: postgres:12
container_name: db12-odoo
restart: unless-stopped
ports:
- 9091:5432
environment:
- POSTGRES_PASSWORD=odoo12
- POSTGRES_USER=odoo12
- POSTGRES_DB=postgres12
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- odoo12-db-data:/var/lib/postgresql/data/pgdata
pgadmin12-demo:
image: dpage/pgadmin4
container_name: pgadmin12
restart: unless-stopped
environment:
PGADMIN_DEFAULT_EMAIL: odoo12#gmail.com
PGADMIN_DEFAULT_PASSWORD: admin
ports:
- 7778:80
volumes:
- pgadmin12-data:/var/lib/pgadmin
depends_on:
- db12-odoo
volumes:
odoo12-web-data:
odoo12-db-data:
pgadmin12-data:
all service is running , but just service odoo12 is not running, when i access localhost:8013 in browser is error, and when i see logs service odoo12 , error like this:
Database connection failure: could not translate host name "db" to address: Temporary failure in name resolution
whats wrong with my config ? thanks
Your database has a DNS name db12-odoo not db. Either change config of your application so that it connects to db12-odoo or change name of the service:
db: # it was called 'db12-odoo' previously
image: postgres:12
container_name: db12-odoo
restart: unless-stopped
ports:
- 9091:5432
environment:
- POSTGRES_PASSWORD=odoo12
- POSTGRES_USER=odoo12
- POSTGRES_DB=postgres12
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- odoo12-db-data:/var/lib/postgresql/data/pgdata
You can also add a network alias instead of changing service name:
db12-odoo:
image: postgres:12
container_name: db12-odoo
restart: unless-stopped
ports:
- 9091:5432
environment:
- POSTGRES_PASSWORD=odoo12
- POSTGRES_USER=odoo12
- POSTGRES_DB=postgres12
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- odoo12-db-data:/var/lib/postgresql/data/pgdata
networks:
default:
aliases:
- db

Resources