<p>If I build the image using <code>docker build .</code> with the below Dockerfile content, I see the label getting listed in the <code>CREATED BY</code> column when I run <code>docker history &lt;image_id&gt;</code>.</p>
<pre><code>IMAGE          CREATED          CREATED BY                                      SIZE      COMMENT

7365e50be12b   12 minutes ago   LABEL version=0.1                               0B        buildkit.dockerfile.v0

missing      12 minutes ago   CMD [&quot;redis-server&quot;]                            0B        buildkit.dockerfile.v0

missing      12 minutes ago   LABEL version=0.0                               0B        buildkit.dockerfile.v0

missing      12 minutes ago   RUN /bin/sh -c apk add --update gcc # buildk…   106MB     buildkit.dockerfile.v0

missing      12 minutes ago   RUN /bin/sh -c apk add --update redis # buil…   5.65MB    buildkit.dockerfile.v0

missing      11 days ago      /bin/sh -c #(nop)  CMD [&quot;/bin/sh&quot;]              0B        
missing      11 days ago      /bin/sh -c #(nop) ADD file:2a949686d9886ac7c…   5.54MB    
</code></pre>
<p>Dockerfile</p>
<pre><code>FROM alpine

RUN apk add --update redis

RUN apk add --update gcc

CMD [&quot;redis-server&quot;]

LABEL version=&quot;0.1&quot;
</code></pre>
<p>My question is: when I create a container and then run commit with <code>-c</code> as</p>
<p><code>docker commit -c 'LABEL version=&quot;0.1&quot;' container id</code></p>
<p>I don't see the <code>LABEL</code> info in the <code>CREATED BY</code> column.</p>
<p>Is there a way to update the <code>CREATED BY</code> column during the <code>commit</code> command?</p>

Deepak Agrawal
<p><code>Label</code> is supported by the docker commit but its is not something you can track with docker image history as its the snapshot of the running container.</p>
<blockquote>
<p>The <code>--change</code> option will apply Dockerfile instructions to the image that is created. Supported Dockerfile instructions: <code>CMD|ENTRYPOINT|ENV|EXPOSE|LABEL|ONBUILD|USER|VOLUME|WORKDIR</code></p>
</blockquote>
<p><a href="https://docs.docker.com/engine/reference/commandline/commit/" rel="nofollow noreferrer">docker-commit</a></p>
<p>You can get the desired result from <code>docker inspect image</code></p>
<pre><code>docker image inspect mynew-label-image | grep version
--
    &quot;version&quot;: &quot;0.1&quot;
</code></pre>
<p>Also, this is not recommended approach to managing change like this</p>
<blockquote>
<p>Generally, it is better to use Dockerfiles to manage your images in a documented and maintainable way.
<a href="https://docs.docker.com/engine/reference/commandline/commit/#description" rel="nofollow noreferrer">commit-recommendation</a></p>
</blockquote>
