"디렉토리를 생성할 수 없습니다. 해당 파일이나 디렉터리가 없습니다."

"디렉토리를 생성할 수 없습니다. 해당 파일이나 디렉터리가 없습니다."

dockerfile을 실행하면 RUN cp -rf roundcubemail-1.2.3/. /var/www/html/명령이 실행되지만 다음 오류가 발생합니다.

cp: cannot create directory '/var/www/html/': No such file or directory
ERROR: Service 'mailserver' failed to build: The command '/bin/sh -c cp -rf 
roundcubemail-1.2.3/. /var/www/html/' returned a non-zero code: 1

이 디렉터리에서 명령을 실행하면 오류가 발생합니다. 권한을 775로 변경했지만 아무 것도 변경되지 않았습니다.

775를 추가하면 RUN cp 775 -rf roundcubemail-1.2.3/. /var/www/html/ 오류가 "디렉토리가 아님"으로 변경됩니다.

답변1

cp상위 디렉터리( www이 경우)가 없으면 다음 오류가 보고됩니다.

$ mkdir src dest
$ touch src/file
$ cp -r src dest/www/html/
cp: cannot create directory ‘dest/www/html/’: No such file or directory

반대:

$ mkdir -p dest/www/html
$ cp -r src dest/www/html/
$ find dest
dest
dest/www
dest/www/html
dest/www/html/src
dest/www/html/src/file

또한 나는 당신의 말을 믿습니다:

RUN cp 775 -rf roundcubemail-1.2.3/. /var/www/html/

명령은 파일 복사를 위한 설정을 install -m승인하는 명령에 대한 참조일 수 있습니다 . 반면에 소스 디렉터리 목록만 필요하므로 명령은 복사할 세 개의 파일/디렉터리를 찾습니다 .MODEcp/var/www/html/

  1. 755
  2. -rf
  3. roundcubemail-1.2.3

이 특정 문제를 해결하려면 Dockerfile에 다음을 추가하는 것이 좋습니다.

RUN mkdir -p /var/www/html

관련 정보