Comments (3)
from cli.
@thaJeztah Hi, I would love to work on this, Please provide pointers and input on how to work on it. Thanks
from cli.
The example given works for setting one Env environment variable, though it seems to be additive only.
Yes, it's following the same rules as a Dockerfile
, which currently doesn't support unsetting properties (see moby/moby#3465).
Can one set multiple Env variables?
Yes, it's possible to set multiple env-vars.
For ENV
, it's possible to combine multiple environments in a single ENV
(again, following the same syntax as the Dockerfile
ENV
syntax);
docker commit --change 'ENV FOO=bar OTHER_ENV=other-value' mycontainer myimage:latest
Or specifying multiple --change
flags;
docker commit \
--change 'ENV FOO=bar'\
--change 'ENV OTHER_ENV=other-value' \
--change 'LABEL hello=world' \
mycontainer myimage:latest
Can one delete an Env variable? Can one completely overwrite all of Env?
No, that's not possible (see my first comment above)
In addition, another syntax seems to work that includes square brackets
Some Dockerfile instructions support a JSON-array syntax, such as the ENTRYPOINT
instruction; https://docs.docker.com/engine/reference/builder/#entrypoint
This syntax could be elaborated upon
I don't think we should elaborate on the syntax itself as part of the docker commit
reference documentation, but given that it already mentions the Dockerfile
syntax, a link to the Dockerfile syntax (https://docs.docker.com/engine/reference/builder/) could be included.
unless using it is not best practice.
As to "JSON-array" ("exec") versus "shell" syntax; some of the (dis)advantages of each are explained in the Dockerfile syntax reference, so I don't think that should be repeated for this command specifically.
As to "best practice" on using docker commit --change
; I would consider docker commit --change
mostly for debugging purposes (for example, to update a failed container's command for debugging).
I would definitely not recommend using docker run
followed by docker commit
to build an image as a recommended workflow; for that, using a Dockerfile
is definitely the recommended approach, as this allows the Dockerfile to describe how the image is built, and allows one to repeat the same build to produce the image.
from cli.
Related Issues (20)
- Could new aliaess be added to mirror existing and which start with 'doc' for example, so can see the docker aliases that are defined?
- Docker service logs are not returned in chronological order HOT 1
- Docker push missing visibility setting HOT 1
- Warning: Kernel Does Not Support cpuset or Cgroup Not Mounted
- docker rmi <image:tag> deletes both amd64 and arm64 builds on Apple Silicon HOT 1
- sysctl issues after upgrade from 25.0.4 to 26.0.0 HOT 1
- Proposal: Adding `docker init` Command to Docker CLI HOT 1
- API from container seem can not get response HOT 3
- build: don't hardcode classic builder for windows daemons HOT 1
- [BUG] 26.0.1 does not allow resources.limits.cpu to be a number HOT 5
- Better error message when trying to pull application/vnd.docker.image.rootfs.diff.tar.zstd layer
- UNIQUE SIZE column of docker system df -v should sum to total image occupancy
- Extend `docker container update` to support updating ports HOT 1
- Bug [26.0.1, build d260a54] - Cannot access service HOT 7
- docker network cannot be recreated after removal
- Image for a running container not visible in docker image ls -a HOT 3
- Docker container keeps increasing memory usage HOT 1
- mapping a container port to multiple host ports doesn't work in host mode
- Is it possible to merge two base images in Docker? HOT 1
- Add `docker create --name= --force` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.