Zero To One

The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing. 오류 해결 본문

docker

The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing. 오류 해결

Zero_To_One 2022. 3. 21. 13:18

1. 

sudo docker-compose up

위와 같은 명령어를 쳤을 때,

 

> sudo docker-compose up
[sudo] jaehyeok의 암호: 
Pulling apache (front:1.1)...
ERROR: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.

Continue with the new image? [yN]y
Pulling apache (front:1.1)...
ERROR: pull access denied for front, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

다음과 같은 오류를 보았다.

 

2. 해결방법

 

sudo docker images

위 명령어를 쳐서 살펴보면..

 

> sudo docker images
REPOSITORY         TAG         IMAGE ID       CREATED             SIZE
front              1.0         1f4a727b6b17   About an hour ago   144MB
ddd/node-web-app   latest      c53ceb5f0591   3 hours ago         115MB
backend            latest      c53ceb5f0591   3 hours ago         115MB
node               12          5b6c488f14dd   2 days ago          918MB
node               16-alpine   41b9374c0901   2 days ago          111MB
<none>             <none>      f06e37d39f4a   2 days ago          161MB
httpd              2.4         b9bd7e513e0f   3 days ago          144MB
httpd              latest      b9bd7e513e0f   3 days ago          144MB

이미지에 대한 내용들이 나온다.

 

그럼 docker-compose.yml로 다시 돌아와서 보면

 

version: "3.0"

services:
  apache:
    image: front:1.1
    restart: 'always'
    ports:
      - "80:80"
    container_name: frontend

  node:
    image: backend
    restart: 'always'
    ports:
      - "3334:80"
    container_name: backend

여기서 docker-compose.yml을 수정해야한다.

 

수정할 부분은 front:1.1 이다.

 

docker image에 보면 Tag 부분에 1.0을 붙여놨었기 때문에 front:1.1 이 아닌 front:1.0을 써주어야 한다.

 

마찬가지로 node : image : backend 부분에서는 tag를 안붙여놨기 때문에 그냥 써주어도 된다.

 

즉, image에는 레파지토리 이름과 테그가 빌드한 이미지와 같아야 한다.

 

수정하고 다시 실행해보면

> sudo docker-compose up
Starting frontend ... done
Starting backend  ... done
Attaching to frontend, backend
frontend  | AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.20.0.2. Set the 'ServerName' directive globally to suppress this message
frontend  | AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.20.0.2. Set the 'ServerName' directive globally to suppress this message
frontend  | [Mon Mar 21 04:16:32.746325 2022] [mpm_event:notice] [pid 1:tid 139966189595968] AH00489: Apache/2.4.53 (Unix) configured -- resuming normal operations
frontend  | [Mon Mar 21 04:16:32.746397 2022] [core:notice] [pid 1:tid 139966189595968] AH00094: Command line: 'httpd -D FOREGROUND'
backend   | Example app listening at http://localhost:80

잘 실행되는 것을 볼 수 있다.