I need to add several lines to /etc/sysctl.conf in a docker image. Is there an idempotent way to do this via a dockerfile rather than editing manually and using the docker commit approach?
相关问题
- Docker task in Azure devops won't accept "$(pw
- Unable to run mariadb when mount volume
- Unspecified error (0x80004005) while running a Doc
- What would prevent code running in a Docker contai
- How to reload apache in php-apache docker containe
I would use the following approach in the
Dockerfile
That should do the trick. If you wish to replace some characters or similar you can work this out with sed by using e.g. the following:
However, if your problem lies in simply getting the settings to "bite" this question might be of help.
sed work pretty well to replace stuff, if you need to append, you can user double redirect
-i
is a non-standard option of GNU sed for inline editing (alleviating the need for dealing with temporary files).