-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathDay2
More file actions
77 lines (56 loc) · 1.5 KB
/
Day2
File metadata and controls
77 lines (56 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# To search for particular image
$ docker search <image name>
$ docker search centos
# To pull a particular image
$ docker image pull <image name>
$ docker image pull centos
# Run a container(Combination of image pull + run)
docker container run -d centos bash
# Show the history of an image
$ docker image history centos
# Dockerfile reference
https://docs.docker.com/engine/reference/builder/
# Dockerfile
FROM ubuntu
RUN apt-get update
RUN apt-get -y install nginx
CMD ["nginx","-g","daemon off;"]
# To build the image out from Dockerfile (without tag)
docker build .
# To build the image out from Dockerfile
docker build -t <tag name> .
# Dockefile copy
FROM busybox
COPY test.txt /tmp
CMD ["sh"]
# Dockerfile add
FROM busybox
ADD https://github.com/100daysofdevops/100daysofdevops/blob/master/README.md /tmp
CMD ["sh"]
# Dockerfile cmd
FROM busybox
CMD ["sh"]
# Dockerfile entrypoint
FROM busybox
ENTRYPOINT ["/bin/ping"]
# To check the image
docker image ls
# Display detailed information on one or more images
$ docker image inspect centos
# Dockerignore
$ cat .dockerignore
*/*.txt
# Containers, Images, Local Volume and Cache Size
docker system df
# For verbose output
docker system df -v
# To test the layer
FROM busybox
RUN dd if=/dev/zero of=/tmp/test1 bs=1M count=50
RUN dd if=/dev/zero of=/tmp/test2 bs=1M count=50
RUN rm -rf /tmp/test1
RUN rm -rf /tmp/test2
# To cleanup images
docker image prune
# To create a new image from a container change
docker container commit <container id> <image name>