0

I have the following docker-compose:

version: "2"
services:
  webserver:
    image: orsolin/docker-php-5.3-apache
    environment:
      ALLOW_OVERRIDE: "true"
      HTTP_PROXY: "${HTTP_PROXY}"
      HTTPS_PROXY: "${HTTPS_PROXY}"
      NO_PROXY: "${NO_PROXY}"
    ports:
      - "8000:80"
    depends_on:
      - db
    volumes:
      - ./app:/var/www/html/

  db:
    image: centos/mariadb-102-centos7
    restart: always
    volumes:
      - ./mysql:/var/lib/mysql/:rw
    environment:
      MYSQL_ROOT_PASSWORD: *redacted*
      MYSQL_USER: *redacted*
      MYSQL_PASSWORD: *redacted*
      MYSQL_DATABASE: *redacted*
      HTTP_PROXY: "${HTTP_PROXY}"
      HTTPS_PROXY: "${HTTPS_PROXY}"
      NO_PROXY: "${NO_PROXY}"
    ports:
      - "8889:3306"

  adminer:
    image: adminer
    restart: always
    environment:
      ADMINER_DEFAULT_DB_DRIVER: mysql
      ADMINER_DEFAULT_DB_HOST: mariadb
      ADMINER_DEFAULT_DB_NAME: adminer
      ADMINER_DESIGN: nette
      ADMINER_PLUGINS: tables-filter tinymce
      HTTP_PROXY: "${HTTP_PROXY}"
      HTTPS_PROXY: "${HTTPS_PROXY}"
      NO_PROXY: "${NO_PROXY}"
    ports:
      - "8282:8080"

After I run docker-compose up -d, the container keeps on restarting and I can see the following when running docker logs --tail 50 --follow --timestamps 01e2489d4526

2019-07-11T10:03:45.554517000Z 2019-07-11 10:03:45 140548938721472 [Note] Plugin 'FEEDBACK' is disabled.
2019-07-11T10:03:45.559329000Z 2019-07-11 10:03:45 140548938721472 [Note] Server socket created on IP: '::'.
2019-07-11T10:03:45.559835000Z 2019-07-11 10:03:45 140548938721472 [ERROR] Can't start server : Bind on unix socket: Permission denied
2019-07-11T10:03:45.560319000Z 2019-07-11 10:03:45 140548938721472 [ERROR] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
2019-07-11T10:03:45.560796000Z 2019-07-11 10:03:45 140548938721472 [ERROR] Aborting

And this is the docker ps output:CONTAINER ID IMAGE

    COMMAND                  CREATED             STATUS                         PORTS                    NAMES
8d7e8d571a1b        orsolin/docker-php-5.3-apache   "apache2-foreground"     7 minutes ago       Up 7 minutes                   0.0.0.0:8000->80/tcp     docker_webserver_1
5f0b1bb872c7        adminer                         "entrypoint.sh doc..."   7 minutes ago       Up 7 minutes                   0.0.0.0:8282->8080/tcp   docker_adminer_1
01e2489d4526        centos/mariadb-102-centos7      "container-entrypo..."   7 minutes ago       Restarting (1) 2 minutes ago                            docker_db_1

How would I fix this, keeping in mind that I will need to be able to connect to the mariadb container from the other containers as well?

Thanks

1

When SELinux is enabled, your containers' volumes should be placed in subdirectories of /var/lib/docker/volumes. Volumes in your home directory will have SELinux contexts that do not allow Docker containers to access them.

  • This is likely the issue. I quit wasting anymore time on it as I already lost 4-5 hours going back and forth. In the end I installed Ubuntu Server. Problem solved :)) – Comforse Jul 12 at 18:02
1

You need to shutdown the container, delete ./mysql/mysql.sock from the host and start it again. For some reason there already is a socket file there and it needs to be removed to start the service correctly.

0

The error is quite clear, you either have to stop your other mysql service or change the port in your config file:

[mysqld]

port= 1234

  • There isnt another mysql service running. The error is inside the docker container. – Comforse Jul 11 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.