Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

877
Views
docker services.web.working_dir contains an invalid type, it should be a string

I am trying to up phpserver via docker-compose. I put 3 files in my working directory.

.env docker-compose.yml Dockerfile

.env

##PATHS

DB_PATH_HOST=./databases
APP_PATH_HOST=./blog
APP_PATH_CONTAINER=/var/www/html/
MYSQL_ROOT_PASSWORD=123456

docker-compose.yml

version: '3'

services:
  web:
    build: .
    environment:
      - APACHE_RUN_USER=www-data
    volumes:
      - ${APP_PATH_HOST}: ${APP_PATH_CONTAINER}
    ports:
      - 8080:80
    working_dir:
      - ${APP_PATH_CONTAINER}
  db:
    image: mariadb
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
    volumes:
      - ${DB_PATH_HOST}: /var/lib/mysql

  adminer:
    image: adminer
    restart: always
    ports:
      - 6080:8080
  composer:
    image: composer:1.7
    volumes:
      - ${APP_PATH_HOST}: ${APP_PATH_CONTAINER}
    working_dir: ${APP_PATH_CONTAINER}
    command: composer install

and Dockerfile

FROM php:7.2-apache

RUN docker-php-ext-install \
     pdo_mysql \
     && a2enmod
     rewrite

But after I try to run

docker-compose up --build

I have the problem

ERROR: The Compose file '.\docker-compose.yml' is invalid because:
services.web.working_dir contains an invalid type, it should be a string
services.composer.volumes contains an invalid type, it should be a string
services.web.volumes contains an invalid type, it should be a string
services.db.volumes contains an invalid type, it should be a string

I tried to change docker-compose file version to 2 - does not work I tried to use '' and "" the same problem.

I want to run my server successfully.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

The following two formats work:

Format #1

environment:
  MYSQL_ROOT_PASSWORD: rootpassword

Format #2

environment:
  - MYSQL_ROOT_PASSWORD=rootpassword
over 4 years ago · Santiago Trujillo Report

0

version: "3.3"

services:
  web:
    build: .
    environment:
      - APACHE_RUN_USER=www-data
    volumes:
      - "${APP_PATH_HOST}: ${APP_PATH_CONTAINER}"
    ports:
      - 8080:80
    working_dir: ${APP_PATH_CONTAINER}
  db:
    image: mariadb
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
    volumes:
      - "${DB_PATH_HOST}:/var/lib/mysql"

  adminer:
    image: adminer
    restart: always
    ports:
      - 6080:8080
  composer:
    image: composer:1.7
    volumes:
      - "${APP_PATH_HOST}: ${APP_PATH_CONTAINER}"
    working_dir: ${APP_PATH_CONTAINER}
    command: composer install

What you used for working_dir was a list. It needed a string.

over 4 years ago · Santiago Trujillo Report

0

I want to connect to from adminer to postgres version: '3'

services:
  web:
    build: .
    environment:
      - APACHE_RUN_USER=www-data
    volumes:
      - ./blog:/var/www/html/
    ports:
      - 8080:80
    working_dir: /var/www/html/
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: kisphp
      POSTGRES_USER: root
      POSTGRES_DB: kisphp
    ports:
      - "5432:5432"
    volumes:
      - ./postgres:/var/lib/postgresql/data
  adminer:
    image: adminer
    restart: always
    ports:
      - "6080:8080"

and I have next error.

SQLSTATE[08006] [7] FATAL: password authentication failed for user "root"
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!