Jump to content

Edit Docker Containers?


skidelo

Recommended Posts

Is it possible to edit docker containers and have your edits persist after making changes in the docker gui?

 

Example:

1) Run an owncloud docker container. (I'm using one from gfjardim's owncloud image)

2) Edit the public key/certificate to a signed certificate that I have.

3) Go into the docker container gui via unRAID web interface.

4) Add a new volume mapping (ie. add /mnt/user/Photo -> /mnt/Photo)

5) Click OK

6) Docker GUI plugin deletes my current container and starts a new one.  This removes any changes I made within the container filesystem.

 

I want to simply edit the 'docker run -v <args>', not delete the entire container and start over.

I'm assuming pulling images updates from upstream will also delete the container and start over.

 

Am I using docker in the wrong fashion?  Sounds like I need to make my own Docker repository or use a VM?

Link to comment

My mappings are all media related. (ie. /mnt/user/Records -> /mnt/Records)

 

Turns out the container uses nginx which looks to the /opt directory for a key and certificate called 'server.pem' and 'server.key'

I supposed I could make a new mapping that overwrites the /opt directory where I could put my own 'server.pem' and 'server.key'.

 

However, this is still limiting.  My certificate is a .crt file rather than .pem file.  And I cannot change that without overwriting the /etc/ngnix directory.

It seems like using docker images more or less restricts you with making changes to the container, unless you manually overwrite every file/directory you want to change as a new volume map.

 

The only way around this that I see, is not to use the docker gui or other people's repos, and fork my own.  Please feel free to tell me I'm wrong.  I'd like things to stay easy :-)

 

Link to comment

AFAIK a crt is a pem formatted file, so you can just rename it. Just rename your keys as server.pem and server.key. If you're using gfjardim's owncloud, he already made it easy for you to import your keys. Just drop them into the config folder (overwrite the ones in there) and restart the server.

 

The container will copy the keys from /config into the correct location during start

 

And as long as your mappings are correct, anything you put into your /config folder should persist through updates, reinstalls, etc.

Link to comment

Nice. Yea I saw that he does that in the /etc/init.d/ startup script.

 

Except I think I still have the same fundamental problem.  Now I want to add a crontab for owncloud background jobs as described here:

https://doc.owncloud.org/server/8.0/admin_manual/configuration_server/background_jobs_configuration.html

 

If I ever add a new mount or update the container, my cron job will get wiped.

You can ask gfjardim to add cron.php or another script to the container's cron, with the actual script residing in the config folder. That way it won't be lost and you can update the script.

 

Or you can fork his repo and send a pull request.

 

I'm afraid that's how docker containers work. The devs have to come up with clever ways to preserve every little thing users would like to change so the changes don't get lost.

 

If you want to really customize the apps, you should either fork and create your own repo or you can run it in a vm.

 

I personally just started using aws ec2 for owncloud. With the free tier, I get 30GB of storage (potentially more if you also use S3) for free for a whole year. Its uptime beats my server and I get better speeds. It works well so far for my startup with a handful of employees. If I need more storage space in the future, I can easily add more as needed and it won't cost much.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...