D
D
Dmitry Baskakov2020-11-24 10:00:27
Docker
Dmitry Baskakov, 2020-11-24 10:00:27

Why does Docker Compose throw an error when specifying a user?

the commands “id -u” and “id -g” give 1000 and 1000
earlier on the assembly with bits I entered 1000:1000 in the .env file. With wordpress, as I understand it, it just doesn't work out that way. Therefore, I tried to build a dockerfile with settings, then I simply entered the user directive in .yml. But nothing worked, in both cases the container crashes with code 1:

myapp_1       | Complete! WordPress has been successfully copied to /var/www/html
myapp_1       | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.28.0.4. Set the 'ServerName' directive globally to suppress this message
myapp_1       | (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
myapp_1       | no listening sockets available, shutting down
myapp_1       | AH00015: Unable to open logs
supportmoodmachineru_myapp_1 exited with code 1


settled on dockerfile for now, so here is the dockerfile:
FROM wordpress

RUN addgroup --gid 1000 user
RUN adduser --disabled-password --gecos '' --uid 1000 --gid 1000 user
USER user


and docker-compose.yml
version: '2'

services:
  mariadb:
    image: 'docker.io/bitnami/mariadb:10.2-debian-10'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - MARIADB_USER=user
      - MARIADB_DATABASE=appdb
      - MARIADB_PASSWORD=password

  phpmyadmin:
    image: 'phpmyadmin/phpmyadmin:latest'
    environment:
      - PMA_HOST=mariadb
      - PMA_USER=user
      - PMA_PASSWORD=password
    ports:
      - 8181:80

  myapp:
    image: 'wordpress'
    user: "1000:1000"
    depends_on:
      - mariadb
    ports:
      - 81:80
    volumes:
      - ./:/var/www/html
volumes:
  myapp:

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question