skip to Main Content

I am trying to make a docker container run off of my docker-compose file:

    version: '3'
    
    services:
      memory_Backend:
        build:
          context: ./
          dockerfile: ./project/docker/DockerfileBackend
        image: memoryapi_ad_img
        volumes:
          - ./:/var/lib
        ports:
          - 15555:25555
    
      memory_Frontend:
        build:
          context: ./
          dockerfile: ./project/docker/DockerfileFrontend
        image: memorywebsite_ad_img
        volumes:
          - ./:/var/lib
        ports:
          - 15556:25556

but it gives me


    WARN[0000] /home/dube_arthur/tp4startingpoint/docker-compose.yml: `version` is obsolete 
    [+] Running 2/2
     ! memory_Backend Warning  pull access denied for memoryapi_ad_img, repository does not exist or may require 'docker login': denied: requested access to the resource is denied                                                            0.8s 
     ! memory_Frontend Warning pull access denied for memorywebsite_ad_img, repository does not exist or may require 'docker login': denied: requested access to the resource is denied                                                        0.8s 
    [+] Building 0.2s (4/4) FINISHED                                                                                                                                                                                                  docker:default
     => [bookapi_frontend internal] load build definition from DockerfileFrontend                                                                                                                                                               0.1s
     => => transferring dockerfile: 2B                                                                                                                                                                                                          0.0s
     => [bookapi_frontend internal] load .dockerignore                                                                                                                                                                                          0.0s
     => => transferring context: 2B                                                                                                                                                                                                             0.0s
     => [bookapi_backend internal] load build definition from DockerfileBackend                                                                                                                                                                 0.1s
     => => transferring dockerfile: 2B                                                                                                                                                                                                          0.1s
     => [bookapi_backend internal] load .dockerignore                                                                                                                                                                                           0.1s
     => => transferring context: 2B                                                                                                                                                                                                             0.1s
    failed to solve: failed to read dockerfile: open /var/snap/docker/common/var-lib-docker/tmp/buildkit-mount2955977944/DockerfileFrontend: no such file or directory   

error

But, my DockerfileFrontEnd and DockerfileBackEnd is in the /project/docker/

also, they look like this


    FROM demers/python420w4a
    COPY ./requirements.txt /
    RUN pip3 install -r /requirements.txt
    RUN apt-get update -y
    RUN apt-get install -y xxd
    WORKDIR /var/lib
    CMD ["./run.sh", "./project/main/memoryapi.py", "25555"]

and my DockerfileFrontEnd is:

    FROM demers/python420w4a
    COPY ./requirements.txt /
    RUN pip3 install -r /requirements.txt
    RUN apt-get update -y
    RUN apt-get install -y xxd
    WORKDIR /var/lib
    CMD ["./run.sh", "./project/app/memoryfront.py", "25556"]

also, my startDocker.sh file is:


    #!/bin/bash
    
    vol_name=memory_ad_vol
    api_cont_name=memoryapi_ad_cnt
    api_image_name=memoryapi_ad_img
    website_cont_name=memorywebsite_ad_cnt
    website_image_name=memorywebsite_ad_img
    
    echo "Début du lancement de l'api et du Site Web dans Docker"
    echo "Le nom pour l'image de l'api: $api_image_name"
    echo "Le nom pour l'image du Site Web: $website_image_name"
    echo "Le nom du volume où vont ce trouver les images et conteneurs: $vol_name"
    echo "Le nom pour le conteneur de l'api: $api_cont_name"
    echo "Le nom pour le conteneur du Site Web: $website_cont_name"
    
    ###CLEANUP
    echo "Stoping everything"
    docker-compose -f docker-compose.yml --project-directory . down
    
    
    ###REBUILD
    echo "Creating everything"
    docker-compose -f docker-compose.yml --project-directory . up -d

and lastly, here is my run.sh file


    #!/bin/bash
    
    export PYTHONPATH=$PWD/project/
    echo python path is: 
    echo $PYTHONPATH
    
    echo "Launching program"
    echo $@
    python3 "$@"

Thanks in advance for the help, as minimal as it may be!


Information Edit 1:

  1. i am in the /tp4startingpoint/ directory, in my linux vm
  2. i dont use docker-compose directly but use my ./startDocker.sh script to do the job for me.

2

Answers


  1. Chosen as BEST ANSWER

    My dockerfile path, in the docker-compose.yml file, are called .../DockerfileBackend and Frontend

    my files names are... FrontEnd and BackEnd..

    just realised it by following the instruction of @Lucas Begnini, and also by changing them in all lowercase, since Docker run (the command) do not accept uppercase naming i guess

        docker: invalid reference format: repository name (project/docker/DockerfileBackend) must be lowercase.
    See 'docker run --help'.
    

  2. First, you can run "docker compose up memory_Backend –build" to run only your backend service and check where is wrong. But I believe it could be a problem with not finding your Dockerfile, the dockerfile path that you passed into docker-compose.
    Whats happen when you run "docker run" into this files?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search