-t 옵션을 통해 image 네임 myservice 과 버젼 latest을 지정합니다. latest 는 기본값입니다.
. 은 통상 Dockerfile 을 칭하며, build 시 Dockerfile 이 존재하는 디렉토리에서 수행해야 합니다.
빌드가 올바르게 될 경우
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
λ docker build -t myservice:latest . Sending build context to Docker daemon 2.048kB Step 1/2 : FROM nginx latest: Pulling from library/nginx 27833a3ba0a5: Pull complete e83729dd399a: Pull complete ebc6a67df66d: Pull complete Digest: sha256:c8a861b8a1eeef6d48955a6c6d5dff8e2580f13ff4d0f549e082e7c82a8617a2 Status: Downloaded newer image for nginx:latest ---> 2bcb04bdb83f Step 2/2 : EXPOSE 80 3050 ---> Running in c70cb71bf110 Removing intermediate container c70cb71bf110 ---> f4b349018422 Successfully built f4b349018422 Successfully tagged myservice:latest SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
Dockerfile 빌드 확인 (docker image)
1 2 3 4
docker images ------------------------------------------------------ REPOSITORY TAG IMAGE ID CREATED SIZE myservice latest f4b349018422 3 minutes ago 109MB