0

I have Docker image which contains config files of VirtualBox and I want to use this image for running multiple containers in parallel.

Config files of VM are being stored on host OS, however, I am afraid of issues with config data of VMs which may occur because of parallel accessing by multiple containers. All containers will be started by Jenkins automatically.

Therefore, could you please tell what is the best way to share data between containers to avoid data corruption because of parallel usage?

Please note: I can not run FreeBSD container under Linux and I can not setup FreeBSD as host OS to use FreeBSD containers as long as Docker is an experimental thing in FreeBSD and Kubernetes is not supported under FreeBSD.

  • Please update the question. – 030 Oct 6 '17 at 11:35
  • Why not running the VM from host ? VirtualBox allow to share a disk between VMs solving your problem, your main problem is adding a process segregation between your virtualbox processes , in brief, you're trying to work against docker isolation for no reason, remove docker from the equation ... – Tensibai Oct 6 '17 at 12:00
  • 2
    Side note: I'm downvoting the question because there's no explanation of why you're using docker in this case. – Tensibai Oct 6 '17 at 12:02
  • Because there is Kubernetes cluster which will manage and redistribute containers in parallel. All tests/instructions will be started from Jenkins. – user54 Oct 6 '17 at 12:04
  • 1
    @user54 Well back to root question: Why on earth running those test on top of a kubernetes cluster at all ? Sometimes you have to take a step back and see something is just a footgun and not a proper solution. Use a normal host with a jenkins agent and start multiples virtualbox on it. what is the target goal ? just testing under freebsd ? creating a vbox image of freebsd for redistribution ? Why freebsd and not switching OS if it brings you that much problems ? – Tensibai Oct 6 '17 at 14:43
1

One could use read-only volumes.

docker run -d \
  -it \
  --name=nginxtest \
  -v nginx-vol:/usr/share/nginx/html:ro \
  nginx:latest

If one would like to use the same volume in multiple containers then one could specify the following when running each container:

-v vol:/usr/share/nginx/html:ro

Note: one could use ro to ensure that the volume is read-only to prevent that multiple containers will write at the same time to the same volume and prevent issues.

  • Yes, but in this case, I have a doubt that VM will be started because I do there: vagrant up; vagrant suspend. – user54 Oct 6 '17 at 10:27
  • Why would you like to run the containers in a VM and not on the host machine itself? – 030 Oct 6 '17 at 10:29
  • Containers will be run on host and inside container will be run VM. – user54 Oct 6 '17 at 10:31
  • 1
    That is valuable information that should be added to the question in my opinion – 030 Oct 6 '17 at 11:33
  • 1
    The question was updated. – user54 Oct 6 '17 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.