Giter Club home page Giter Club logo

Comments (8)

chrisparnin avatar chrisparnin commented on August 26, 2024 1

Yes, this is very possible. We’ve had this working in our embedded ansible server (Baker) for virtualbox and hyper-kit. Will create a demo Dockerfile with this working.

from slim.

chrisparnin avatar chrisparnin commented on August 26, 2024 1

Closing issue since we now support sync by default. Can revisit any problems with new issue. Thanks!

from slim.

chrisparnin avatar chrisparnin commented on August 26, 2024

The basic idea for virtualbox is up and running. Requires a few steps, with pointers to line in Dockerfile or init: https://github.com/ottomatica/slim-images/tree/master/alpine3.8-vbox-mount

  • Need to add virtualbox-guest-modules-virt to kernel layer in order to get right kernel modules.

  • Need to add virtualbox-guest-additions to main layer.

  • Need to mount share in init:

    modprobe vboxsf 
    mkdir -p /shared
    mount.vboxsf -o uid=1000,gid=1000 vbox-share-0 /shared
    

Now, can access shared folder (set to / of host-system by virtualbox-provider).

$ slim build alpine3.8-vbox-mount
$ slim run m0 alpine3.8-vbox-mount
...
Executing VBoxManage sharedfolder add m0 --name "vbox-share-0" --hostpath "/" 
....
nanobox:~# ls /shared/Users/cjparnin/projects/slim-images/
README.md               alpine3.8-kubernetes    alpine3.9-runc-ansible  ubuntu16.04-kubernetes
alpine3.8-datascience   alpine3.8-vbox-mount    docs                    ubuntu16.04-simple

Hyperkit, is going to be a bit more "gnarly".

from slim.

chrisparnin avatar chrisparnin commented on August 26, 2024

Ok, proof-of-concept for hyperkit shared folders for @blissdev:
image

First, build this image in the slim-images repo.

slim build slim-images/alpine3.8-9p-mount

The main difference is that you just add steps to mount the 9p network filesystem in the init script.

# 9p
mkdir -p /shared
modprobe 9pnet_virtio
mount -t 9p -o trans=virtio shared /shared 

However, the real difference is how you run hyperkit (see run.sh).

a) You need to pass a unix socket that will be used for 9p protocol.
b) You need a 9p filesystem server running.

I've provided a proof of concept script that does this. It will boot up this image directly in hyperkit.

cd slim-images/alpine3.8-9p-mount/scripts/ && ./run.sh 
...
nanobox:~# ls /shared/
Applications               home
Library                    installer.failurerequests
Network                    net
System                     opt
Users                      private

At some point, we can migrate some of this leg work into slim.

from slim.

blissdev avatar blissdev commented on August 26, 2024

@chrisparnin Wow, thank you so much for putting this together! I was initially thinking that hyperkit may provide a better experience, but from your perspective what do you think is the better option? Will hyperkit be lighter weight? Any advice?

from slim.

chrisparnin avatar chrisparnin commented on August 26, 2024

Honestly, this is probably something that would best be answered with longer term experimentation.

My use cases tends to center around being able to quickly spin up VMs, doing some local testing for infrastructure scripts, and throwing them away. For this, VirtualBox, isn't so bad, and actually can be ready just as fast as hyperkit. Hyperkit might be better for compute heavy tasks, but it is also pretty rough around the edges when it comes to other features.

from slim.

blissdev avatar blissdev commented on August 26, 2024

Guess I'll have to experiment, thanks again! :)

from slim.

gjabell avatar gjabell commented on August 26, 2024

Slim will now automatically mount / at /host and cwd (ie the directory where you run the slim run command) at /slim within the VM. This automounting can be disabled by passing the --nosync option in the slim run command.

from slim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.