Docker Community Forums

Share and learn in the Docker community.

2Containers/services running; only 1 Container has a Local folder

Hi all.

As the title suggests, I have 2 Containers.
1 is Apache+PHP
2 is MySQL server

In the Kinematic app, both Containers/Services are listed on the left pane and both are running with no errors, with the exception of:

apache2: Could not reliably determine the server's fully qualified domain name, using 172.19.0.3. Set the 'ServerName' directive globally to suppress this message

Under VOLUMES in the left pane, MySQL displays both, a Docker Folder and a Local Folder. However, the Apache+PHP container only displays the Docker folder.
Why has the Local Folder not auto mounted? and how can i mount it?

“docker run --help” gives me alot of Options, which is great, but the problem is, i dont know what im suppose to do in this case.

I’ve searched Google Alot! Im getting nowhere, just frustration.
Can someone please point me to an article outlining this stuff, or better yet, tell me how to fix this?

My Docker Project directory/file structure;

lamp_php73/Containers/apache
lamp_php73/Containers/mysql
lamp_php73/WWW
lamp_php73/docker-compose.yml
lamp_php73/LAMP_php73.Dockerfile
lamp_php73/LAMP_php73_MYSQL.Dockerfile

docker-Compose.yml

version: '2'
services:
  apachephp:
    build:
        context: ./
        dockerfile: LAMP_php73.Dockerfile
    ports:
        - "80:80"
        - "443:443"
    volumes:
        - lamp_php73_CONFIG:/Containers/apache
        
          
  mysql:
    build:
        context: ./
        dockerfile: LAMP_php73_MYSQL.Dockerfile 
    ports:
        - "3306:3306"  
    environment:
        MYSQL_ROOT_PASSWORD: ''
        MYSQL_ALLOW_EMPTY_PASSWORD : 'yes'
    restart: always
    volumes:
        - lamp_php73_MYSQL_CONFIG:/Containers/mysql     
    
volumes:
  lamp_php73_CONFIG:
  lamp_php73_MYSQL_CONFIG:  

LAMP_php73.Dockerfile

FROM ubuntu:focal
WORKDIR /CODE
ENV PORT 80
#ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y software-properties-common
RUN add-apt-repository ppa:ondrej/php
RUN add-apt-repository ppa:ondrej/apache2

RUN apt-get update -y
RUN apt-get upgrade -y

#---CORE Essentials
RUN apt-get install -y gcc
RUN apt-get install -y make
RUN apt-get install -y autoconf
RUN apt-get install -y libc-dev
RUN apt-get install -y pkg-config 
RUN apt-get install -y composer


#——————————————— [*** LAMP Stack ***] ———————————
#---APACHE2 
RUN apt-get install -y apache2
RUN apt-get install -y libapache2-mod-php 

#---PHP
RUN curl -s "https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh" | /bin/bash
RUN apt-get install -y php7.3-phalcon
RUN apt-get install -y php7.3-dev
RUN apt-get install -y php-common 
RUN apt-get install -y php-cli

#---PHP Extensions 
RUN apt-get install -y php-mysql 
RUN apt-get install -y php-curl 
RUN apt-get install -y php-gd
RUN apt-get install -y php-json 
RUN apt-get install -y php-mbstring
RUN apt-get install -y php-bcmath
RUN apt-get install -y php-xml
RUN apt-get install -y php-readline
RUN apt-get install -y php-intl
RUN apt-get install -y php-zip
RUN apt-get install -y php-bz2
RUN apt-get install -y zlib1g-dev
RUN apt-get install -y libmemcached-dev


CMD ["apachectl","-D","FOREGROUND"]
RUN a2enmod rewrite
EXPOSE 80
EXPOSE 443
#CMD ["dir"]

LAMP_php73_MYSQL.Dockerfile

FROM mysql:5.7.25
ENV MYSQL_ALLOW_EMPTY_PASSWORD='yes'
EXPOSE 3306

Where is this going wrong?

@imdebdut Help?
Is there no Administrator from @Docker that can help?

I’m sorry. Been busy the whole day today unfortunately.

Looks like there isn’t. You may join their slack though. I left a tweet today https://twitter.com/imdebdut/status/1338327170565828610?s=19 , but no response.

hm. Im at a complete stands-til… unless i get access to the contents of the apache installation , i cant do anything…

Why change the image itself? Define the environment variable in the compose file, which you’re already doing.

You can ignore this message.

I’m very unclear on what you’re trying to say here. What do you mean by a “Docker folder” and “Local folder”?

This is in the Kitematic app.
lamp_php73_mysql_1 VOLUMES; Dispalys: /Containers/mysql and /var/lib/mysql(the true mysql dir which has all the mysql files and cert.) BUT
lamp_php73_apachephp_1 VOLUMES; Displays: only /Containers/apache(which is empty) . I dont have a volume listed for the true apache dir. eg, /etc/apache2/

I’m afraid I do not have any experience with Kitematic. Please provide the output of the following command.

docker container inspect -f '{{ .Mounts }}' lamp_php73_apachephp_1

I’m guessing the container name from your given data.

The output i get is: [ ] ,
Its empty.

Output of docker ps -a ?

CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                                      NAMES
42685983e529        lamp_php73_apachephp   "apachectl -D FOREGR…"   6 minutes ago       Up 6 minutes        0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   lamp_php73_apachephp_1
ac8d0669eabd        lamp_php73_mysql       "docker-entrypoint.s…"   6 minutes ago       Up 6 minutes        0.0.0.0:3306->3306/tcp, 33060/tcp          lamp_php73_mysql_1
(base) fishIn:lamp_php73 tom$

Perhaps its the COMMAND? and docker-entrypoint? I recall seeing ‘entrypoint’ in few places…

Looking at your compose file, I see absolutely zero reasons for not having any volumes attached to the apachephp container. Could you please also show the output of docker volume ls ?

DRIVER              VOLUME NAME
local               5427080c49e7760640a4f311038450fe54f0ada76811a5ef5199d69b6bd73a46
local               DATA
local               WWW
local               b2bdb8f1fe06d1476549387dc84610ef0477eae8a1036b253f788baf7b0a9368
local               lamp_php73_lamp_php71_CONFIG
local               lamp_php73_lamp_php71_MYSQL_CONFIG

So the volumes are there. Next question, what are the purposes of the directories Containers/apache and Containers/mysql ? Also how did you deploy the containers? Which command did you exactly run?

Yes they are definitely mounted and running.
Nevermind the Containers/apache and Containers/mysql its just how i set it up based on watching the Getting Started tutorial video. Those directories are empty at the momemt, perhaps they will serve me a purpose later on… the main thing is having access to the apache files.

To start the services i use : docker-compose up -d , and both services are created.
edit----

Same as “starting the services”.

I see then no reason for the volumes not being used. Could you stop the services and restart them (and show me the output of docker-compose up -d) ? Use docker-compose down -v to stop the services, this will destroy the volumes. I hope you don’t have any important data right now.

No, no important data. I shutdown with docker-compose down -v
and docker-compose up -d output is:

WARNING: The Docker Engine you're using is running in swarm mode.

Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.

To deploy your application across the swarm, use `docker stack deploy`.

Creating network "lamp_php73_default" with the default driver
Creating volume "lamp_php73_lamp_php71_MYSQL_CONFIG" with default driver
Creating lamp_php73_mysql_1     ... done
Creating lamp_php73_apachephp_1 ... done

Which compose file are you actually using? It sure is not the one you posted here. This also confirms that, which I missed previously. The volume names do not match.

You mean the docker-compose.yml?
The one thats posted here in post #1 is the docker-compose thats used.

I have changed it a little bit now, by removing the “volumes:
- lamp_php71_CONFIG:/Containers/apache” , but i havent recompiled.

There’s nothing to “compile” here.

Use the very first compose file, fresh, and it should just work.

I may have sounded slightly rough there, I’m just tired. Don’t mind that.

1 Like