-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathdocker-cli-new-switches
60 lines (32 loc) · 2.3 KB
/
docker-cli-new-switches
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
# New docker-cli
1. Creation of New Image, from a running container, Commit to docker images via running container put new tag & push to repo, it helps just git commit
# https://docs.docker.com/engine/reference/commandline/commit/
Example
--------
docker exec -it nginx bash
apt update -y && apt install -y vim
exit
docker commit -m "vim is installed" -a "Muhammad Asim [email protected]" running-container newtag
------------------------------------------------------------------------------------------------------------------------
docker commit -m "vim is installed" -a "Muhammad Asim [email protected]" nginx quickbooks2018/nginx-with-vim:v1
------------------------------------------------------------------------------------------------------------------------
docker commit containerid newtag:v1
2. SIZE of running container, you will see the size after Installing vim 51.MB is size of writable layer & 133MB is ---> docker images ----> nginx image totall size
docker ps -s
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE
c34b272d2f7e nginx "/docker-entrypoint.…" 30 minutes ago Up 30 minutes 0.0.0.0:80->80/tcp nginx 51.1MB (virtual 184MB) 133+51
Example:
--------
docker ps -s
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE
17daf3f2ef23 nginx "/docker-entrypoint.…" 6 seconds ago Up 5 seconds 0.0.0.0:8080->80/tcp nginx2 1.12kB (virtual 133MB) ---> pure nginx
c34b272d2f7e nginx "/docker-entrypoint.…" 35 minutes ago Up 35 minutes 0.0.0.0:80->80/tcp nginx 51.1MB (virtual 184MB ---> after vim installed
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
quickbooks2018/nginx-with-vim v1 6f71de76181e 12 minutes ago 184MB
nginx latest f6d0b4767a6c 3 weeks ago 133MB
_______________________________________________________________________________________________________________________
docker commit --change='CMD ["apachectl", "-DFOREGROUND"]' -c "EXPOSE 80" c3f279d17e0a svendowideit/testimage:version4
3. Dockerfile
WORKDIR nginx /usr/share/nginx/html
COPY index.html index.html