Failed to setup apache, php , mysql and adminer - docker

I am trying to use docker and setup apache, php, mysql and adminer using this docker-compose.yml
The apache, php and mysql have been run. I have test it using php codes. But, the adminer can't do login.
version: "3.2"
services:
php:
image: php:latest
build: './php/'
networks:
- backend
volumes:
- ./public_html/:/var/www/html/
apache:
image: httpd:latest
build: './apache/'
depends_on:
- php
- mysql
networks:
- frontend
- backend
ports:
- "8000:80"
volumes:
- ./public_html/:/var/www/html/
mysql:
image: mysql:latest
networks:
- backend
environment:
- MYSQL_ROOT_PASSWORD=admin
adminer:
image: adminer
restart: always
links:
- mysql
ports:
- "8080:8080"
networks:
frontend:
backend:

You are already using port 8080 on the host, so you need to either proxy pass using apache and dont share the port on adminer, or use a different port
adminer:
image: adminer
ports:
- 8081:8080

Your docker container is named mysql other than the default in adminer db. So you need to add environment variable for your adminer container like below.
adminer:
image: adminer
restart: always
ports:
- "8080:8080"
environment:
- ADMINER_DEFAULT_SERVER=mysql
and links are deprecated remove it. For any other issue please read the docker hub description.

Related

Persist nifi data and volume

I want to make my nifi data volume and configuration persist means even if I delete container and docker compose up again I would like to keep what I built so far in my nifi. I try to mount volumes as follows in my docker compose file in volumes section nevertheless it doesn't work and my nifi processors are not saved. How can I do it correctly? Below my docker-compose.yaml file.
version: "3.7"
services:
nifi:
image: koroslak/nifi:latest
container_name: nifi
restart: always
environment:
- NIFI_HOME=/opt/nifi/nifi-current
- NIFI_LOG_DIR=/opt/nifi/nifi-current/logs
- NIFI_PID_DIR=/opt/nifi/nifi-current/run
- NIFI_BASE_DIR=/opt/nifi
- NIFI_WEB_HTTP_PORT=8080
ports:
- 9000:8080
depends_on:
- openldap
volumes:
- ./volume/nifi-current/state:/opt/nifi/nifi-current/state
- ./volume/database/database_repository:/opt/nifi/nifi-current/repositories/database_repository
- ./volume/flow_storage/flowfile_repository:/opt/nifi/nifi-current/repositories/flowfile_repository
- ./volume/nifi-current/content_repository:/opt/nifi/nifi-current/repositories/content_repository
- ./volume/nifi-current/provenance_repository:/opt/nifi/nifi-current/repositories/provenance_repository
- ./volume/log:/opt/nifi/nifi-current/logs
#- ./volume/conf:/opt/nifi/nifi-current/conf
postgres:
image: koroslak/postgres:latest
container_name: postgres
restart: always
environment:
- POSTGRES_PASSWORD=secret123
ports:
- 6000:5432
volumes:
- postgres:/var/lib/postgresql/data
pgadmin:
container_name: pgadmin
image: dpage/pgadmin4:4.18
restart: always
environment:
- PGADMIN_DEFAULT_EMAIL=admin
- PGADMIN_DEFAULT_PASSWORD=admin
ports:
- 8090:80
metabase:
container_name: metabase
image: metabase/metabase:v0.34.2
restart: always
environment:
MB_DB_TYPE: postgres
MB_DB_DBNAME: metabase
MB_DB_PORT: 5432
MB_DB_USER: metabase_admin
MB_DB_PASS: secret123
MB_DB_HOST: postgres
ports:
- 3000:3000
depends_on:
- postgres
openldap:
image: osixia/openldap:1.3.0
container_name: openldap
restart: always
ports:
- 38999:389
# Mocked source systems
jira-api:
image: danielgtaylor/apisprout:latest
container_name: jira-api
restart: always
ports:
- 8000:8000
command: https://raw.githubusercontent.com/mvrabel/nifi-postgres-metabase/master/api_examples/jira-api.json
pipedrive-api:
image: danielgtaylor/apisprout:latest
container_name: pipedrive-api
restart: always
ports:
- 8100:8000
command: https://raw.githubusercontent.com/mvrabel/nifi-postgres-metabase/master/api_examples/pipedrive-api.yaml
restcountries-api:
image: danielgtaylor/apisprout:latest
container_name: restcountries-api
restart: always
ports:
- 8200:8000
command: https://raw.githubusercontent.com/mvrabel/nifi-postgres-metabase/master/api_examples/restcountries-api.json
volumes:
postgres:
nifi:
openldap:
metabase:
pgadmin:
Using Registry you can achieve that all changes you are doing or your nifi are committed to git. I.e. if you change some processor configuration, it will be reflected in your git repo.
As for flow files, you may need to fix volumes mappings.

What to use as base url in magento2 when using docker?

I have simple docker orchestration to serve Magento files
here is my docker-compose.yml:
version: "3"
services:
php:
build: docker/php
volumes:
- .:/var/www/html
db:
image: mariadb:10.4
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: magento
volumes:
- ./docker/mysql/databases:/var/lib/mysql
nginx:
image: nginx:alpine
ports:
- 8009:80
links:
- php:phpfpm
volumes:
- ./docker/nginx/conf.d:/etc/nginx/conf.d
- ./docker/nginx/magento.conf:/etc/nginx/magento.conf
- .:/var/www/html
elasticsearch:
image: bitnami/elasticsearch:7
ports:
- 9200:9200
volumes:
- ./docker/elasticsearch/data:/bitnami/elasticsearch/data
as you see, I want to serve the store on my host machine port 8009.
My question is, what should I set base-url when using setup:install command and installing my Magento store?
If I set it to something like localhost or 127.0.0.1, when accessing localhost:8009 it redirects me to 127.0.0.1 which is obviously the wrong location
When you use to customer port in docker you want to use a base URL is URL: port.
example =>
base_url=https://localhost:8009/

Get seen on a local network Docker-Composer

I am currently working on a mobile app that connects to a server instance in docker through a docker-compse instance that can be see by an emulator on my developemnt machine fine, but if I try and use my mobile I can't see the server as it is not on the same network. is there easy way I can set this up to so it can be seen by both my emulator and my mobile at the same time.
my Docker composer setup is
version: '3.1'
services:
node:
container_name: nodejs
build: .
#restart: always
ports:
- 8080:8080
- 3000:3000
volumes:
- .:/usr/src/app
environment:
PORT: 3000
extra_hosts:
- "nodeserver:10.1.1.222"
depends_on:
- mongo
mongo:
container_name: mongodb
image: mongo
restart: always
ports:
- 27017:27017
volumes:
- ./db:/data/db
command: mongod
mongo-express:
container_name: mongoExpress
image: mongo-express
restart: always
ports:
- 9081:8081
environment:
ME_CONFIG_MONGODB_USERNAME: admin
ME_CONFIG_MONGODB_PASSWORD: password
depends_on:
- mongo
I am not a big net-ops guy some so any real help here would appreciated.

Use another container inside of the other

I started using docker and I have created a basic docker-compose.yml file. The problem I am facing currently is that I have multiple containers that need to be one. My docker-compose.yml file:
version: '3.7'
services:
redis:
container_name: redis
image: redis
ports:
- "6379:6379"
mongodb:
container_name: mongodb
image: mongo
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: devmyoy123
ports:
- "27017:27017"
node:
container_name: node
image: node
volumes:
- ./node/:/var/app/node
environment:
REDIS_URI: redis://redis:6379
links:
- mongodb
- redis
ports:
- "9000:9000"
httpd:
container_name: httpd
image: php:7.2-apache
volumes:
- ./api/:/usr/local/apache2/htdocs
environment:
REDIS_URI: redis://redis:6379
links:
- mongodb
- redis
- node
ports:
- "80:80"
- "443:443"
I need a way to use node inside the httpd container and I also need the mongodb and redis parameters inside of httpd and node containers.

Docker Compose | Virtual Hosts

Whats wrong in my code? thanks in advance!
I'm trying to set up a virtual host for my docker container.
On localhost: 8000 works perfectly, but when I try to access through http: //borgesmelo.local/ the error ERR_NAME_NOT_RESOLVED appears, what can be missing?
This is my -> docker-compose.yml
version: '3.3'
services:
borgesmelo_db:
image: mariadb:latest
container_name: borgesmelo_db
restart: always
volumes:
- ./mariadb/:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: My#159#Sql
MYSQL_PASSWORD: My#159#Sql
borgesmelo_ws:
image: richarvey/nginx-php-fpm:latest
container_name: borgesmelo_ws
restart: always
volumes:
- ./public/:/var/www/html
ports:
- "8000:80"
borgesmelo_wp:
image: wordpress:latest
container_name: borgesmelo_wp
volumes:
- ./public/:/var/www/html
restart: always
environment:
VIRTUAL_HOST: borgesmelo.local
WORDPRESS_DB_HOST: borgesmelo_db:3306
WORDPRESS_DB_PASSWORD: My#159#Sql
depends_on:
- borgesmelo_db
- borgesmelo_ws
borgesmelo_phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: borgesmelo_phpmyadmin
links:
- borgesmelo_db
ports:
- "8001:80"
environment:
- PMA_ARBITRARY=1
borgesmelo_vh:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- "8002:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
default:
external:
name: nginx-proxy
This is my hosts file (/etc/hosts) [macOS]
#DOCKER
127.0.0.1:8000 borgesmelo.local
Hosts file doesn't support ports as it is for name lookup only. So you would have to set your hosts file to:
127.0.0.1 borgesmelo.local
Then access your application with http://borgesmelo.local:8000.
If you are listening on port 8000 because you already have something else on port 80, then consider using nginx as a reverse proxy and then you can route to different applications based on the server_name. That way, you can access multiple applications through port 80. If you're dealing with docker containers, then consider looking into Traefik as a reverse proxy.

Resources