0

I'm just getting started in docker and maybe I'm starting of a little big but I found an article that explained out to get a coldfusion install (run by commandbox) up with mysql. This docker compose works just fine. I had the idea of adding in phpmyadmin so that I can us that to connect to mysql.

For reference the original article is here: https://cfswarm.inleague.io/part3-docker-in-development/part3-running-docker

So I modified the docker compose yml pull in the phpmyadmin

    version: '3.6'  # if no version is specificed then v1 is assumed. Recommend v2 minimum
volumes:
  sql-data:
networks:
  cfswarm-simple:
secrets:
  cfconfig:
    file: ./config/cfml/cfconfig.json

services:       
  cfswarm-mysql:        # a friendly name. this is also DNS name inside network
    image: mysql:5.7
    container_name: cfswarm-mysql
    environment:
      MYSQL_ROOT_PASSWORD: 'myAwesomePassword'
      MYSQL_DATABASE: 'cfswarm-simple-dev'
      MYSQL_ROOT_HOST: '%'
      MYSQL_LOG_CONSOLE: 'true'
    volumes:    
      - type: volume
        source: sql-data
        target: /var/lib/mysql
    ports: 
      - 3306:3306
    networks:
        - cfswarm-simple
  cfswarm-cfml:
    image: ortussolutions/commandbox:alpine
    container_name: cfswarm-cfml
    volumes:
      - type: bind
        source: ./app-one
        target: /app
    ports: 
      - 8081:8080        
    env_file:
      - ./config/cfml/simple-cfml.env
    secrets:
      - source: cfconfig # this isn't really a secret but non-stack deploys don't support configs so let's make it one
        target: cfconfig.json
    networks:
        - cfswarm-simple
    depends_on:
      - cfswarm-mysql
      - cfswarm-nginx
  cfswarm-two-cfml:
    image: ortussolutions/commandbox:alpine
    container_name: cfswarm-two-cfml
    volumes:
      - type: bind
        source: ./app-two
        target: /app
    env_file:
      - ./config/cfml/simple-cfml.env
    secrets:
      - source: cfconfig # this isn't really a secret but non-stack deploys don't support configs so let's make it one
        target: cfconfig.json
    depends_on:
      - cfswarm-mysql
      - cfswarm-nginx
    networks:
        - cfswarm-simple
  **phpmyadmin:
        image: phpmyadmin/phpmyadmin:latest
        container_name: phpmyadmin
        restart: always
        environment:
          PMA_HOST: cfswarm-mysql
          PMA_USER: root
          PMA_PASSWORD: 'myAwesomePassword'
        ports:
             - "8082:80"**       
  cfswarm-nginx:
    image: nginx
    command: [nginx-debug, '-g', 'daemon off;']
    container_name: cfswarm-nginx
    ports:
      - 80:80
      - 443:443
    volumes:
      - type: bind
        source: ./app-one
        target: /var/www/app-one
      - type: bind
        source: ./app-two
        target: /var/www/app-two
      - type: bind
        source: ./nginx/
        target: /etc/nginx
    networks:
      - cfswarm-simple

So right at line 63 I added in the pull for phpymyadmin which appears to work, it does answer on port 8082 but it gives me an error:

MySQL said: Documentation

Cannot connect: invalid settings.
 mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
 mysqli::real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
 phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

The one thing that I could not get to work was adding in the network of cfswarm-simple. When I tried to add the line right under ports (line 72) I would get an error when trying to start the docker compose.

Right now, I'd like to be able to connect to the mysql docker with the docker of phpmyadmin.

TIA

weggie
  • 101
  • 1

1 Answers1

0

I was able to figure out that it was a spacing issue. Make sure any new entry matches the spaces that are used before.

weggie
  • 101
  • 1