2

I have been currently working on Laravel application using Docker and i run this command successfully: docker-compose up -d --build

I have been trying to run this command in the Laravel Project: docker-compose exec app composer install

And it was working fine but i don't know why this command giving me this error right now:

`Traceback (most recent call last):
  File "bin/docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 72, in main
  File "compose/cli/main.py", line 128, in perform_command
  File "compose/cli/main.py", line 524, in exec_command
  File "compose/cli/main.py", line 1498, in call_docker
  File "subprocess.py", line 323, in call
  File "subprocess.py", line 775, in __init__
  File "subprocess.py", line 1433, in _execute_child
  File "os.py", line 809, in fsencode
TypeError: expected str, bytes or os.PathLike object, not NoneType
[3639] Failed to execute script docker-compose`

I am new to docker and don't know how to resolve this issue. I even though have tried re-installing docker again. I have been using ubuntu 18.10.

docker --version: Docker version 19.03.5, build 633a0ea838

docker-compose --version docker-compose version 1.25.0, build 0a186604

docker-compose.yml networks: `

app-network:
    driver: bridge
services:
  app:
    build:
      context: /home/abdullah_16f8418/Documents/G-Hire
      dockerfile: Dockerfile
    depends_on:
    - db
    - laravel_echo_server
    - redis
    environment:
      SERVICE_NAME: app
      SERVICE_TAGS: dev
    networks:
      app-network: null
    restart: unless-stopped
    volumes:
    - /home/abdullah_16f8418/Documents/G-Hire:/var/www/html:rw
    - /home/abdullah_16f8418/Documents/G-Hire/.docker/php/local.ini:/usr/local/etc/php/conf.d/local.ini:rw
    working_dir: /var/www/html
  db:
    environment:
      MYSQL_DATABASE: laravel
      MYSQL_PASSWORD: laraveluserpass
      MYSQL_ROOT_PASSWORD: rootpass
      MYSQL_USER: laraveluser
      SERVICE_NAME: mysql
      SERVICE_TAGS: dev
    healthcheck:
      interval: 30s
      retries: 5
      test: mysqladmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD
      timeout: 10s
    image: mysql:5.7.22
    networks:
      app-network: null
    restart: unless-stopped
    volumes:
    - /home/abdullah_16f8418/Documents/G-Hire/.docker/data/db:/var/lib/mysql:rw
    - /home/abdullah_16f8418/Documents/G-Hire/.docker/mysql/my.cnf:/etc/mysql/my.cnf:rw
  laravel_echo_server:
    build:
      context: /home/abdullah_16f8418/Documents/G-Hire/.docker/laravel-echo
      dockerfile: echo.dockerfile
    healthcheck:
      interval: 30s
      retries: 5
      test: wget --quiet --tries=1 --spider http://localhost:6001 || exit 1z
      timeout: 10s
    networks:
      app-network: null
    restart: unless-stopped
    volumes:
    - /home/abdullah_16f8418/Documents/G-Hire/.env:/app/.env:rw
  redis:
    healthcheck:
      interval: 30s
      retries: 5
      test:
      - CMD
      - redis-cli
      - ping
      timeout: 10s
    image: redis:5-alpine
    networks:
      app-network: null
    restart: unless-stopped
    volumes:
    - /home/abdullah_16f8418/Documents/G-Hire/.docker/data/redis:/data:rw
  webserver:
    healthcheck:
      interval: 30s
      retries: 5
      test: wget --quiet --tries=1 --spider https://public-chat.jamesisme.com || exit
        1z
      timeout: 10s
    image: nginx:alpine
    networks:
      app-network: null
    ports:
    - 8000:80/tcp
    restart: unless-stopped
    volumes:
    - /home/abdullah_16f8418/Documents/G-Hire:/var/www/html:rw
    - /home/abdullah_16f8418/Documents/G-Hire/.docker/nginx/conf.d:/etc/nginx/conf.d:rw
version: '3.0'

`

3 Answers 3

4

In my case the problem was at line 12 in .env file for docker-compose. I have deleted it, and that all.

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

This solved my problem and I would never come up that this was a problem! Thank you! I had the same thing. In .env file I had a variable without any value, just REDIS_URL and no REDIS_URL=
1

I think you have a problem with your image try to delete them and download them again like this

docker-compose kill
docker rmi $(docker images -a -q)
docker-compose up --force-recreate

4 Comments

i have been now getting this error while running docker rmi $(docker images -a -q): Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/images/json?all=1: dial unix /var/run/docker.sock: connect: permission denied "docker rmi" requires at least 1 argument. See 'docker rmi --help'
Did you try to sudo it or can I do docker ps -a and then use the container id?
I got resolved the issue after re-installing docker. THANKS!
Were your second issues solved with sudo? you can also mark your question as solved ;)
1

first use docker-compose config to see which env value cause the problem.

In my case:

...
POSTGRES_USER: '''some_user'''
SQLALCHEMY_DATABASE_URI:'"postgresql://<user>:<pass>@<host>:<port>/<db>"'
'~': null
...

So obviously the tilde '~' from vim on new line caused the problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.