Skip to Content
Suffering builds character
아카이브25.devopsDocker특징4.도커 허브3.도커 허브에 이미지 Push

3.도커 허브에 이미지 Push

1-1. Dockerhub에 이미지 올리기(Push)

docker push 명령어를 통해 Local에 존재하는 도커 이미지를 Remote에 Push할 수 있음

terminal
docker push {사용자명}/{Repository이름}

↓

terminal
docker push junghoyou2/getting-started

아래와 같은 에러 발생

terminal
Using default tag: latest The push refers to repository [docker.io/junghoyou2/getting-started] An image does not exist locally with the tag: junghoyou2/getting-started

1-2. 이미지에 계정이름 태깅

이미지를 Repository에 push하기 위해서는 이미지 이름 앞에 도커 계정명에 대한 참조를 추가해야함

terminal
docker tag getting-started {Docker 계정이름}/getting-started

→ getting-started라는 이름의 이미지를 Docker계정이름/getting-started로 변경

다시 push 명령어 수행

terminal
docker push junghoyou2/getting-started

실행 결과

terminal
Using default tag: latest The push refers to repository [docker.io/junghoyou2/getting-started] eb30ccc475be: Preparing 45ca239a542d: Preparing 86fdd6f572ef: Preparing efdc30a9b9c0: Preparing a7ede14bfe13: Preparing d49996f6d982: Waiting d4fc045c9e3a: Waiting denied: requested access to the resource is denied

→ 에러 발생, denied: requested access to the resource is denied

로컬 환경에서 Dockerhub 내 자신의 Repository에 push할 수 있도록 로그인 필요

1-3. 도커 로그인

docker login 명령어를 통해 로그인을 수행할 수 있음

terminal
docker login --username junghoyou2

실행 결과

terminal
docker login --username junghoyou2 Password: WARNING! Your password will be stored unencrypted in /home/ubuntu/.docker/config.json. Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store Login Succeeded

패스워드 입력 후 로그인

1-4. 다시 push 진행

terminal
docker push junghoyou2/getting-started

실행 결과

terminal
Using default tag: latest The push refers to repository [docker.io/junghoyou2/getting-started] eb30ccc475be: Pushed 45ca239a542d: Pushed 86fdd6f572ef: Pushed efdc30a9b9c0: Mounted from library/node a7ede14bfe13: Mounted from library/node d49996f6d982: Mounted from library/node d4fc045c9e3a: Mounted from library/node latest: digest: sha256:567c7a97900f6cd64267ad18307039859e2bfc1ad14dcac2c7b85bba830effc0 size: 1787

1-5. Dockerhub에서 이미지가 Push되었는지 확인

Tags 탭에서 확인

Last updated on