My Studied Log
1. Created Docker file 2. Build Container by referencing Docker file 3. Run Container■"From”
pointing out Base Image file composing dockerfile
(1)Start Docker deamon
$sudo systemctl start docker
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4173f3027999 ubuntu:16.04 "bash" 16 hours ago Exited (0) 16 hours ago dreamy_elion
7f5e26aad2ce hello-world "/hello" 23 hours ago Exited (0) 23 hours ago agitated_galileo
(2)Create Dockerfile ,then build Docker image using it.
*Posted created file into below directory.
/home/ec2-user/samplefilebox
*contents
$ cat Dockerfile_sample
FROM ubuntu
RUN echo foo
RUN echo bar
$ chmod +x Dockerfile_sample
$ docker build -f Dockerfile_sample -t build:from_simple .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM ubuntu
latest: Pulling from library/ubuntu
7413c47ba209: Pull complete
0fe7e7cbb2e8: Pull complete
1d425c982345: Pull complete
344da5c95cec: Pull complete
Digest: sha256:c303f19cfe9ee92badbbbd7567bc1ca47789f79303ddcef56f77687d4744cd7a
Status: Downloaded newer image for ubuntu:latest
---> 3556258649b2
Step 2/3 : RUN echo foo
---> Running in e0f5b8c0b42c
foo
Removing intermediate container e0f5b8c0b42c
---> cf507a94be22
Step 3/3 : RUN echo bar
---> Running in 463f6b46421a
bar
Removing intermediate container 463f6b46421a
---> 450c66ab74e2
Successfully built 450c66ab74e2
Successfully tagged build:from_simple
*-f : quating file
*-t : pointing out tagname
(3)comfirmed from "docker images"
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
build from_simple 450c66ab74e2 3 minutes ago 64.2MB
sampledocker latest f669c3195c60 16 hours ago 203MB
ubuntu 16.04 5e13f8dd4c1a 11 days ago 120MB
ubuntu latest 3556258649b2 11 days ago 64.2MB
hello-world latest fce289e99eb9 7 months ago 1.84kB
■ENV
setting Environment variable into docker container.
stile is below 2type there.
- ENV
- ENV =...
■LABEL
Added metadata to Docker images.
■RUN
by executing shell command, setup container.
■EXPOSE
Declarate Port that will use in the container.
■ENTRYPOINT / CMD
Specified command that will be executed when container starts