Pages

Saturday, November 6, 2021

Docker : COPY failed: file not found in build context or excluded by .dockerignore



I wanted copy /root/master directory in /var/  like this : cp -R /root/master /var/

However, I had the following error : COPY failed: file not found in build context or excluded by .dockerignore

I found the solution on Stackoverflow :

The <src> path must be inside the context of the build; you cannot COPY ../something /something, because the first step of a docker build is to send the context directory (and subdirectories) to the docker daemon.

In fact, I needed to copy the master directory in a Docker sub folder because I used a docker-compose.yml with services:

version: "3"
services:
  master:
    container_name: master
    env_file:
      - variables.env
    build:
        context: ./subdirectory1/
        dockerfile: Dockerfile
        args:

 My structure folders :

docker-compose.yml 
subdirectory1/
DockerFile
        master/
subdirectory2
DockerFile


So in your DockerFile, add the following :

RUN mkdir -p /var
WORKDIR /var

To copy the whole directory :
COPY ./master .

To copy subdirectories :
COPY ./master/ .

Docker version 20.10.8, build 3967b7d

Saturday, October 16, 2021

Reminder : undo git add command


Just to remember a simple command...

Add a file in order to be managed by GIT : 

git add filename

If you want to undo the git add command  :

git reset file

Friday, October 15, 2021

apt-get install php7.3-curl failed

 

I had a problem when installing the php7.3-curl dependency :

The package dependies was not satisfied :
 php7.3-curl : Depend: libcurl3 (>= 7.44.0) but not installable

In fact, the problem occurs because I forgot to change stretch to buster in my configuration :

 vi /etc/apt/sources.list.d/php7.3.list
deb https://packages.sury.org/php/ buster main


Then I restarted :

apt-get remove --auto-remove php7.3-curl
apt-get purge --auto-remove php7.3-curl
apt-get install php7.3-curl

PlayConsole : suppression des warnings lors de la publication (minify, symbole de debogage...)

Lors de la publication des versions dans la PlayConsole, j'avais 2 warnings pour indiquer qu'il était possible de réduire et d'o...