Why does CMD Command generate a new layer?

282 views Asked by At

All.

I have one question about Docker Layer images.

I think that RUN, ADD, COPY, CMD commands generate a new layer. However, I wonder why CMD command generates a new layer.

For example, I understand that "ADD hoge.txt /var/tmp" requires a layer because the command generates a new file "hoge.txt".However, the command "/bin/bash" generates nothing.

Would you tell me the reason?

In addition, it seems that the command "CMD ["/bin/bash"]" in centos7 Official Image generates a layer including some files as described below.

├── dev
│   ├── console
│   ├── pts
│   └── shm
└── etc
    ├── hostname
    ├── hosts
    ├── mtab -> /proc/mounts
    └── resolv.conf
0

There are 0 answers