0

For development I want to mount a file share from my windows dev box inside my CoreOS VM, so I can then mount that volume inside a container.

CoreOS doesn't appear to support doing this, and comes with no package manager; the idea being it is only a minimalist host for containers.

$ cat /proc/filesystems
nodev   sysfs
nodev   rootfs
nodev   ramfs
nodev   bdev
nodev   proc
nodev   cgroup
nodev   cpuset
nodev   tmpfs
nodev   devtmpfs
nodev   debugfs
nodev   securityfs
nodev   sockfs
nodev   pipefs
nodev   devpts
nodev   hugetlbfs
nodev   pstore
nodev   mqueue
nodev   autofs
        ext3
        ext2
        ext4

I can mess around with the container and mount it from within the container but I was having trouble getting that setup via Dockerfiles and entrypoint scripts; also that approach feels hacky: Containers shouldn't worry about where the data is stored, they just ask for a volume. In production I'd be using AWS storage or Azure storage, etc, so I'd have to modify my images for different host AND i can't use the official images.

So yeah I'm 99 percent sure I need to mount it within the CoreOS host, but don't know how to do it.

Mark
  • 13
  • 3

1 Answers1

0

The fundamental principles of containers is that they should be portable and completely self contained. It should not have any external dependencies that are environment specific, (like a specific network share).

Instead of making your container inside CoreOS, you should build your container on a dedicated build host which has access to the network share. All files that are needed by the container should then be encapsulated inside the container, or a volume container and pushed to CoreOS using the docker registry.

CoreOS isn't really meant for development work. It is meant to be used for deployments. You may find vagrant gives a better workflow since it can mount volumes between the host and the guest.

spuder
  • 1,725
  • 3
  • 26
  • 42
  • Shared folders in vagrant windows won't work because it uses CIFS. in the error message: mount -t cifs -o uid=`id ...etc mount: wrong fs type, bad option, bad superblock on //192.168.0.139/f16b89c58f4ca0c81d75058c99c7492f, missing codepage or helper program, or other error (for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount. helper program) and that's simply commenting the example in the VagrantFile config.vm.synced_folder ".", "/home/core/share", id: "core", :nfs => true, :mount_options => ['nolock,vers=3,udp'] – Mark Jul 01 '15 at 01:21
  • I'm using this container as my registry. The simplest way to pull source in and save out built containers (for backup,etc) would be to have CoreOS mount the SMB share or some other network file system and tell the container to use it. Is this impossible ? – Mark Jul 01 '15 at 01:39
  • CoreOS is designed for massive container deployments. Your best bet will be to use Ubuntu / CentOS as your registry machine and install docker on it. CoreOS isn't designed for this particular workflow and will just end up getting in the way. – spuder Jul 01 '15 at 03:41
  • @Mark: have you tried https://hub.docker.com/r/so0k/mount.cifs_copy/ , you can put this in a OneShot unit to auto mount your windows host shares. – Vincent De Smet Dec 31 '15 at 07:50
  • alternatively use a docker volume plug-in such as https://github.com/gondor/docker-volume-netshare - see: http://stackoverflow.com/a/34487598/138469 – Vincent De Smet Dec 31 '15 at 07:53