반응형

도커 이미지 목록 보기

docker images
REPOSITORY                    TAG       IMAGE ID       CREATED         SIZE
<none>                        <none>    41f3cc7950e7   26 hours ago    122MB
docker-study                  0.1       73995ae21233   26 hours ago    122MB
jshag90/docker-study          1.0       73995ae21233   26 hours ago    122MB
<none>                        <none>    99ce48eca45d   26 hours ago    122MB
alpine/git                    latest    04dbb58d2cea   4 weeks ago     25.1MB
centos                        latest    300e315adb2f   2 months ago    209MB
docker/getting-started        latest    3c156928aeec   10 months ago   24.8MB
myheritage/centos7-git-java   latest    4e93d8b41499   3 years ago     649MB

도커 이미지 내보내기

docker save docker-study:0.1 > docker-study0.1.tar
728x90
반응형

powershell에서 도커 로그인하기

docker login

Authenticating with existing credentials...
Login Succeeded

도커 이미지 확인하기

PS D:\DockerWork\DockerStudy> docker images
REPOSITORY               TAG       IMAGE ID       CREATED         SIZE
<none>                   <none>    99ce48eca45d   3 hours ago     122MB
docker-study             0.1       73995ae21233   3 hours ago     122MB
<none>                   <none>    41f3cc7950e7   3 hours ago     122MB
alpine/git               latest    04dbb58d2cea   4 weeks ago     25.1MB
docker/getting-started   latest    3c156928aeec   10 months ago   24.8MB

로컬 도커가 있고 도커hub에 올리기 위한 이미지 태그 생성하기, 계정명/도커이미지명

도커hub에 동일한 docker-study라는 repository를 생성하거나 명령어로 추가 가능함

docker image tag docker-study:0.1 jshag90/docker-study:1.0
PS D:\DockerWork\DockerStudy> docker images
REPOSITORY               TAG       IMAGE ID       CREATED         SIZE
<none>                   <none>    41f3cc7950e7   3 hours ago     122MB
<none>                   <none>    99ce48eca45d   3 hours ago     122MB
docker-study             0.1       73995ae21233   3 hours ago     122MB
jshag90/docker-study     1.0       73995ae21233   3 hours ago     122MB
alpine/git               latest    04dbb58d2cea   4 weeks ago     25.1MB
docker/getting-started   latest    3c156928aeec   10 months ago   24.8MB

다음과 같이 명령어를 사용할 경우 도커허브에 repository가 생김

docker push jshag90/docker-study:1.0
728x90
반응형

도커 설정 파일 생성

해당패키지에 도커 설정 파일(Dockerfile)

# Start with a base image containing Java runtime
FROM openjdk:8-jdk-alpine

# Add Author info
LABEL maintainer="jshag1990@gmail.com"

# Make port 8080 available to the world outside this container
# 해당 패키지는 8080포트로 외부로 열겠다라는 의미
EXPOSE 8080

# The application's jar file
ARG JAR_FILE=build/libs/DockerStudy-0.0.1-SNAPSHOT.jar 

# Add the application's jar to the container
ADD ${JAR_FILE} to-do-springboot.jar

# Run the jar file
ENTRYPOINT ["java","-jar","/to-do-springboot.jar"]

윈도우에서는 powershell을 이용

도커 이미지 생성

docker build --tag docker-study:0.1 .

도커 이미지 실행

docker run -p 18080:8080 docker-study:0.1
728x90

+ Recent posts