Docker Compose Adminer - docker

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

Related

volumes.sms-service Additional property build is not allowed

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

Docker compose Unable to connect

I've created docker-compose.yml file with the following content. My docker service runs ok, docker run hello-world works just fine and after running command
docker-compose build && docker-compose up -d
I see no errors but in the browser I'm getting an error Unable to connect when I go to localhost:8000
version: '3'
services:
nginx:
image: nginx:stable-alpine
container_name: nginx
volumes:
- ./src:/var/www/html
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
ports:
- "8000:80"
depends_on:
- php
- mysql
php:
build:
context: .
dockerfile: Dockerfile
container_name: php
volumes:
- ./src:/var/www/html
ports:
- "9000:9000"
mysql:
image: mysql:8.0
container_name: mysql
restart: unless-stopped
ports:
- "3306:3306"
volumes:
- ./mysql:/var/lib/mysql
environment:
MYSQL_DATABASE: db
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: root
SERVICE_NAME: mysql
When I run command
docker-compose exec php ls
I can see the list of files and folders

docker local host:8888 not opening

i have created a task-management-compose.yml in which I added
version: '3.1'
services:
db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: 123456
ports:
- 5432:5432
adminer:
image: adminer
restart: always
ports:
- 8888:8080
# rabbitmq:
# image: rabbitmq:3-management
# ports:
# - "15672:15672"
# - "5672:5672"
after then I open command line and type docker-compose -f task-management-compose.yml up -d its work fine
but when I type localhost:8888 it shows nothing

Preventing development containers from running in production

I have a docker-compose.yml file that includes a container for API mocks as well as phpmyadmin and mongo-express containers none of which should be started in my production environment.
I already have seperate .env files for production and development. Is it possible to use variables from the active .env file to disable a container?
Here is my docker-compose.yml:
services:
mysql:
build: ./docker/mysql
command: --default-authentication-plugin=mysql_native_password
container_name: mysql
entrypoint: sh -c "/usr/local/bin/docker-entrypoint.sh --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci"
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USERNAME}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_RANDOM_ROOT_PASSWORD=yes
- MYSQL_ONETIME_PASSWORD=yes
ports:
- 3306:3306
restart: unless-stopped
volumes:
- ./data/mysql:/var/lib/mysql
phpmyadmin:
container_name: phpmyadmin
environment:
- PMA_HOST=mysql
image: phpmyadmin/phpmyadmin
ports:
- 8080:80
mongo:
build: ./docker/mongo
container_name: mongo
environment:
- MONGO_INITDB_DATABASE=${MONGO_DATABASE}
- MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD}
ports:
- 27017:27017
restart: unless-stopped
volumes:
- ./data/mongo:/data/db
mongo-express:
build: ./docker/mongo-express
container_name: mongo-express
depends_on:
- mongo
environment:
- ME_CONFIG_BASICAUTH_PASSWORD=redacted
- ME_CONFIG_BASICAUTH_USERNAME=username
- ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_USERNAME}
- ME_CONFIG_MONGODB_ADMINPASSWORD=${MONGO_PASSWORD}
ports:
- 8081:8081
redis:
build: ./docker/redis
container_name: redis
ports:
- 6379:6379
restart: unless-stopped
volumes:
- ./data/redis:/data
mock-apis:
build: ./docker/mock-apis
container_name: mock-apis
command: >
/initscript.bash
ports:
- 81:80
volumes:
- ./mock-apis:/home/nodejs
php-fpm:
build:
context: ./docker/php-fpm
args:
HOST_UID: ${HOST_UID}
command: >
/initscript.bash
container_name: php-fpm
restart: unless-stopped
depends_on:
- mongo
- mysql
- redis
volumes:
- ./laravel:/var/www/
nginx:
build: ./docker/nginx
container_name: nginx
depends_on:
- php-fpm
ports:
- 80:80
restart: unless-stopped
volumes:
- ./laravel:/var/www/
version: "3"
I'm using profiles to scope my services. If I want to use PhpMyAdmin only in dev I add this profile to the service:
phpmyadmin:
container_name: phpmyadmin
environment:
- PMA_HOST=mysql
image: phpmyadmin/phpmyadmin
ports:
- 8080:80
profiles: ["dev"]
So now I have to tell to docker compose if I want to use the dev profile. Else it will not start.
You can use one of these command (with this way you have to type --profile your_profil for each profile):
$ docker-compose --profile dev up -d
$ docker-compose --profile dev --profile profil2 up -d <- for multiple profiles
Or the cleaner way you can separate your services with a comma:
$ COMPOSE_PROFILES=dev,profil2 docker-compose up -d
Services without a profiles attribute will always be enabled.
Care about when you stop your services you have to specify the profile too:
$ COMPOSE_PROFILES=dev docker-compose down

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

Resources