-
Notifications
You must be signed in to change notification settings - Fork 16
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
Persistent Environments #7
Comments
Hi @ruffsl Thanks for sharing your ideas. Nut is young and new features are welcome. I'm not sure I understand what you want to do though. Is any of the following related?
syntax_version: "4"
project_name: caffe
based_on:
docker_image: matthieudelaro/work-on-caffe
container_working_directory: /opt/caffe
mount:
...
macros:
...
volumes: # new element of the syntax
... # define docker volumes to mount here |
I'd like to mount an entire root linux file system used in the container, here is a sample script example I made to mount ever file in target directory as a folder in the root path. This was any system wide modifications made to the linux filesystem, like from an apt-get install, in the container could be preserved over container lifespans. This as opposed to repeatedly remembering to commit the container to an image, and flattening it if it gets too large. By the way, how is nut's yaml file focuses and interests different from say a docker-compose yaml config? |
While the Compose files are closely related to docker (you have to know how to use Docker in order to use compose files), the aim of Nut files is to describe what environment you want, even from the perspective of someone who doesn't know (much/anything) of docker. The philosophy is to define macros and request features (eg: GUI), not the unix sockets that you wish to expose to achieve this feature (eg: socket /tmp/.X11-unix). Nut takes care of this depending on the OS you are running, Docker Toolbox vs Docker for Mac, etc. Now, you've probably noticed that version 4 doesn't respect this philosophy, if you consider that you have to specify working directory and mounting point. But at the beginning, the working directory and the mouting point were the current folder by default, so the only parameter about docker was the image you wished to use. This should be fixed by adding a parameter such as 'use_current_dir: yes Another point: this simplistic philosophy for nut file addresses the need of users of environment (inheriting complex configuration from GitHub), but not the providers of environments (sharing their nut.yml on GitHub). Which is why nut files have to provide most configurations for Docker somehow. As you and @kohlerm (issue #9) point out, it leads to a compose-like file / it could be implemented with a compose file. However, compose files do not declare macros or equivalent, which is the point of nut files. So the idea of inheriting from a compose file seems nice to me: # nut.yml
# ...
based_on:
compose:
path: path/to/docker-compose.yml
service: reddis # name of service described in compose file
# ... If the goal of using compose file is to generate a whole architecture of containers, I think this should happen in the container instead. Nut lunches a container based on an image name it has been provided, and you can do whatever you want in this container (compose, swarm, ...) Thoughts? What do you think about this? |
I solved this problem in my not yet open sourced pet project by assuming that there is always some kind of a top-level workspace directory |
the idea about the compose file is that it has a well known syntax for defining parameters for running a container. which would be needed for what I described above. So maybe compose could be used for defining default parameters and then you mostly override the volume parameters. In any case emulating the compose syntax would be IMHO be good to lower the learning curve for people. |
@ruffsl : support for docker volumes has been added in commit f8146fb @kohlerm : from syntax V7, volumes:
volume-example:
volume_name: myvolume
container_path: /mnt/myvolume
equivalent-of-mount-in-V6:
host_path: .
container_path: /go/src/ Simply supporting docker-compose syntax is not trivial, because compose relies on docker client to run to start containers, whereas Nut calls docker host through docker api. This implies implementing all the nice features of docker cli (some of which are bottlenecks). Moreover, compose have similar limitations as docker cli when it comes to paths for volumes (can't include a Plus, declaring volumes and devices (devices are supported now) as a dictionary instead of a list is useful to override parent configuration. |
@matthieudelaro , nut looks like a neat project, just stumbled across it from you nvidia-docker issue. I'm interested in many of the same objectives you mention on the project readme. On a related note though, how do you feel about abusing volumes as a method to enable persistent development environments?
Perhaps is would take away from the portability or repeatably of the environments, but it would be convenient for when I need something like a persistent VM to tradition my user space apps from one linux LTS to the next, but would like to skip a hyper-visors or manual chroots.
https://forums.docker.com/t/persistent-development-environment-using-docker/9279
The text was updated successfully, but these errors were encountered: