Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add an editor to the image #217

Open
DvagNic opened this issue Jan 29, 2020 · 2 comments
Open

Please add an editor to the image #217

DvagNic opened this issue Jan 29, 2020 · 2 comments

Comments

@DvagNic
Copy link

DvagNic commented Jan 29, 2020

Since config files have to be edited inside the container, it would be nice if the image would include vim or another editor. I know that if one uses volumes, one can edit the files on the host, but for Docker on the Mac the volumes are located inside a "hidden" VM and it is not that easy to reach that VM. Editing from within the container makes life easier :)

@jjethwa
Copy link
Owner

jjethwa commented Jan 30, 2020

Hi @DvagNic

I think there was a security recommendation not to include editors in production ready images. Is there any way to get easy access to those volumes? Sorry, I've never used Docker for Mac, so I don't know offhand 😄

@xurizaemon
Copy link

xurizaemon commented Feb 28, 2021

@DvagNic a few options to consider. Caveat that I'm not on Mac, so the first two of these I'm less sure of given your initial report.

Edit the files directly

You can directly edit the relevant configuration files from outside the running Docker images. For example, to modify /etc/icinga2/conf.d/users.conf inside the container, you can edit data/icinga2/etc/icinga2/conf.d/users.conf in your local project. This may require fiddling with permissions in the host OS, or using sudo to bypass permissions (then perhaps fiddling with them later).

Use another docker image to obtain vim

If it's significant to you that the files be edited from within a running Docker image, you can do that too, and without needing to modify the base images. Use docker run with another base image (eg dilshad/alpinevim is a Docker image with just vim available), and specify the relevant volumes. This gives you the existing, no-vim base images from this project, and a ready way to execute vim alongside those running images as required.

docker run -ti -v /home/dvagnic/docker-icinga2/data/icinga/etc/icinga2:/etc/icinga2 dilshad/alpinevim vim /etc/icinga2

You could add such a configuration to the images in this project's docker-compose.yml for your own use.

Fork and modify jordan/icinga2 base image

If you needed to be able to deploy a version of this with vim pre-installed, that's possible from a Docker image which extends jordan2/icinga2 Docker image. Something like,

FROM jordan/icinga2

apt-get install vim

Publish that image somewhere (eg DockerHub), then consume it from a modified docker-compose.yml and you're in business.

Hope that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants