denied: requested access to the resource is denied 해결 방법

docker hub에 이미지를 푸시하려고 할 때, denied: requested access to the resource is denied 에러가 발생할 수 있습니다.

원인

이유는 크게 두 가지입니다.

  1. docker hub에 로그인하지 않았을 경우
  2. docker tag를 할 때 username이 틀렸을 경우

해결 방법

1번의 경우, docker hub의 계정이 없다면 여기서 회원가입을 하고 docker login을 통해 로그인합니다.

2번의 경우에는, docker tag를 올바르게 했는지 확인합니다.

docker tag [image]:[tag] [username]/[repository]:[tag]

[username] 은 docker hub에서 사용하고 있는 account 이름


이제 다음과 같이 적용합니다.

docker build -t yj-iris-preprocessing .

현위치를 의미하는 .을 빠뜨리지 않도록 주의하고, yj-iris-preprocessing 이라는 이미지를 빌드합니다.

docker images를 통해 yj-iris-preprocessing 이라는 이미지가 잘 빌드된 것을 볼 수 있습니다.

tag는 따로 명시하지 않아서 latest로 만들어주네요.

docker tag yj-iris-preprocessing:latest yongjuncho/yj-iris-preprocessing:v1.0

저는 yj-iris-preprocessing이라는 repo에 v1.0으로 태그를 달아주었습니다.

docker push yongjuncho/yj-iris-preprocessing:0.5

마지막으로, push까지 해주면 docker hub에 이미지가 잘 올라간 것을 확인할 수 있습니다.