volumes.sms-service Additional property build is not allowed - docker

I can't run MYSQL first in docker compose
services:
mysql:
image: mysql:latest
command: --default-authentication-plugin=mysql_native_password
restart: unless-stopped
volumes:
- mydb:/var/lib/mysql
- ./init:/docker-entrypoint-initdb.d
environment:
MYSQL_DATABASE: db
# Password for root access
MYSQL_ROOT_PASSWORD: root
ports:
# <Port exposed> : < MySQL Port running inside container>
- 3307:3306
volumes:
mydb:
sms-service:
image: sms-service:latest
container_name: SMS-service
network_mode: bridge
restart: unless-stopped
build:
context: /home/iv/Desktop/service-SMS
dockerfile: dockerfile
volumes:
- /home/iv/Desktop:/usr/src/app/dir
- /var/run/dbus:/var/run/dbus

Related

Docker Compose Adminer

I want to use the adminer image that is raised with the following docker command:
docker run \
--rm
-p 8000:80
-e MEMORY=512M
-e UPLOAD=4096M
dockette/adminer:full
My docker-compose.yml is as follows:
version: '2.4'
services:
mariadb:
container_name: mariadb-prueba
image: mariadb
restart: always
volumes:
- ./mariadb-data:/var/lib/mysql
environment:
MYSQL_DATABASE: 'db_prueba'
MYSQL_USER: 'admin'
MYSQL_PASSWORD: 'admin'
MARIADB_ROOT_PASSWORD: 'admin'
ports:
- 2000:3306
adminer:
container_name: adminerprueba
image: dockette/adminer
restart: always
ports:
- 8000:80
environment:
- UPLOAD=4096M
- MEMORY=512M
volumes:
mariadb-data:
The problem is that it runs but when I do localhost:8000 the system appears to be down.
Am I missing something in the docker-compose

docker: Why do I access to phpmyadmin?

and excuse me for my English.
I'm using docker in wsl 2 and I have a docker application with three images: laravel, phpmyadmin and mysql
my problem is what I can not access to phpmyadmin.¿can I help me please?
Attached image of the docker application running.
Whe I tye to access to phpmyadmin, appearc not found page.
docker-compose.yml
version: '3.8'
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.0
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.0/app
ports:
- '${APP_PORT:-80}:80'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
mysql:
image: 'mysql:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' #empty(niether)
MYSQL_DATABASE: '${DB_DATABASE}' #fastfood
# MYSQL_USER: '${DB_USERNAME}' #root
MYSQL_PASSWORD: '${DB_PASSWORD}' #empty
MYSQL_HOST: '${DB_HOST}' #localhost
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
volumes:
- 'sailmysql:/var/lib/mysql'
networks:
- sail
phpmyadmin:
image: 'phpmyadmin'
container_name: pma
environment:
PMA_HOST: '${DB_HOST}' #localhost
PMA_PASSWORD: '${DB_PASSWORD}' #empty(niether)
PMA_ARBITRARY: 1
restart: always
ports:
- 8081:80
depends_on:
- mysql
networks:
- sail
networks:
sail:
driver: bridge
volumes:
sailmysql:
driver: local
information
windows 10 19052.1052
docker 3.5.1
Use http://localhost:8081/ instead.
/phpmyadmin is just a route that set for the server software like wamp for you to access phpmyadmin easily.
Since you have defined in your docker-compose.yml
phpmyadmin:
image: 'phpmyadmin'
...
ports:
- 8081:80
...
which is port 8081

How can I connect a adminer docker container with a mariadb docker container?

I was trying to create a PHP development environment with PHP, MariaDB, and a tutorial suggested to use Adminer for database management. So I generate my docker-compose.yml file like this:
version : '3.1'
services:
php:
build:
context: .
dockerfile: Dockerfile
ports:
- 80:80
volumes:
- ./src:/var/www/html/
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
volumes:
- ./mariadb-data:/var/lib/mysql
adminer:
image: adminer
environment:
ADMINER_DEFAULT_SERVER: db
restart: always
ports:
- 8080:8080
But when I set the volumes for MariaDB, I got an error in the Adminer login page. When I don't set them it seems to work well.
version : '3.1'
services:
php:
build:
context: .
dockerfile: Dockerfile
ports:
- 80:80
volumes:
- ./src:/var/www/html/
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
volumes:
- ./mariadb-data:/var/lib/mysql
adminer:
image: adminer
environment:
ADMINER_DEFAULT_SERVER: db
restart: always
ports:
- 8080:8080
links:
- php
- db

docker-compose cannot connect to mysql

After hours of trying different things I find googling, still can't connect to MySQL.
This is my docker-compose.yaml
version: '3.5'
services:
apache:
build: .
container_name: apache-dot
restart: unless-stopped
volumes:
- ./www-data:/var/www
depends_on:
- mysql
ports:
- 80:80
mysql:
image: mysql:5.7
container_name: mysql-dot
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: xxxxxxxx
MYSQL_DATABASE: xxxxxxx
volumes:
- mysql-data:/var/lib/mysql
- ./mysql-dump:/docker-entrypoint-initdb.d
ports:
- 3306:3306
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin-dot
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: xxxxxxx
depends_on:
- mysql
ports:
- 8000:80
networks:
default:
volumes:
mysql-data:
driver: local
Docker compose builds correctly no with no errors.
docker logs and docker inspect doesn't reveal anything wrong.
docker network inspect looks good also.
Any help will be much appreciated.
Thank you.
SOLVED
I've had to add to the PHPMyAdmin service PMA_HOST: mysql.
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin-dot
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: xxxxxxx
PMA_HOST: mysql <====
depends_on:
- mysql
ports:
- 8000:80

Docker connect database from a container (laravel) to other container (wordpress)

I have two project using docker, in first project is laravel, and second is wordpress. In laravel I want to connect both database (to convert laravel database to wordpress database).
but I don't know how to connect it:
here is two docker-compose.yml file:
in laravel:
version: '2'
services:
# The Application
app:
build:
context: ./
dockerfile: app.dockerfile
working_dir: /var/www
volumes:
- ./:/var/www
environment:
- "DB_PORT=3306"
- "DB_HOST=database"
# The Web Server
web:
build:
context: ./
dockerfile: web.dockerfile
working_dir: /var/www
volumes_from:
- app
ports:
- 8081:80
# The Database
database:
image: mysql:5.6
volumes:
- dbdata:/var/lib/mysql
environment:
- "MYSQL_DATABASE=homestead"
- "MYSQL_USER=homestead"
- "MYSQL_PASSWORD=secret"
- "MYSQL_ROOT_PASSWORD=secret"
ports:
- "33061:3306"
volumes:
dbdata:
and my docker-compose.yml file in wordpress:
version: '2'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: 123456
MYSQL_DATABASE: wpshop
MYSQL_USER: root
MYSQL_PASSWORD: 123456
wordpress:
depends_on:
- db
image: wordpress:latest
volumes:
- ./:/var/www/html
ports:
- "8080:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: 123456
volumes:
db_data:
I cd to each project and run docker-compose up -d
Please help me!
Create an external network and use that network as default network for all your containers. This way you'll be able to reach all container by its name.
Take a look to Docker container networking: https://docs.docker.com/engine/userguide/networking/

Resources