Can Docker do functions like the so-called file synchronization function in Vagrant?

Asked 1 years ago, Updated 1 years ago, 89 views

I would like to create a UNIX or LINUX environment within WindowPC.

I would like to do them with Docker or Vagrant, but
I'm technically interested in Docker, and I'm going to do it there.

However, you may want to synchronize the downloaded images and files on Windows PC to a virtual environment during development.

Vagrant has a file synchronization function, so there should be no problem.
Does Docker have such a function?

I thought it might not come out, so I asked you a question.

Thank you for your cooperation.

vagrant docker virtualbox

2022-09-30 17:22

3 Answers

First of all, Linux (Unix?) on WinPC, but I think the configuration itself is not Docker or Vagrant, but Virtualbox or HyperV.
Docker cannot run directly on Windows (there seems to be a tool called Boot2 Docker that uses VirtualBox to simulate Docker on Windows).

So VirtualBox has a folder sharing function (which Vagrant's folder sharing seems to be basically using), so if you want to share files, you can build them with VirtualBox.


2022-09-30 17:22

@hayachi617's supplement +α.

Q: Does docker synchronize files with the host?
A: Yes (-v option), but docker is a program that runs on linux in the first place and can be synchronized between host linux and container linux, which is the closest answer to the question.

Q: Is there a file synchronization with the host on boot2docker?
A: It looks like it is.(After all, it appears to have been implemented in the shared folder in virtualbox + docker -v)

Q: What if you wanted to develop Linux on Windows?
A: My personal recommendation is virtualbox+vagrant+docker. (I don't think it's easy to design docker only as a virtual development environment.)

Please refer to the following.

From the perspective of developing on Windows in a Linux environment:

What is virtualbox?Software that provides virtual machines, similar to vmware, which can be communicated with hosts <-> virtual machines or shared folders, ultimately because the software provides them as a feature.(The shared folder looks like a plug-in to VirtualBox)

What is vagrant?Software that automates management and operations on "software that provides virtual machines".Vagrantfile is easy to use to describe the virtual machine configuration in a declarative manner.

What is docker: Virtualization application execution software running on linux, which treats virtualized file system +α as a container, and the linux kernel runs processes in the context of containers while using the host.Containers are designed to run specific programs (pull).

Boot2docker is exactly what @hayachi617 explained.


2022-09-30 17:22

I would like to create a UNIX or LINUX environment within WindowPC.

It's December 31, 2019.
Enabling WSL on Win10 makes it relatively easy to use the LINUX environment.
On the Win10 side, you can read and write the WSL file system using the following paths:

\wsl$\Ubuntu-18.04\home\XXXXX

It's easy to assign and use a drive.この In this example, drive S.
subst S:\\wsl$\Ubuntu-18.04\home\XXXXX

You can also read and write to the Win10 file system from WSL.
Each drive is mounted under /mnt.

Below is the Ubuntu running on the WSL.

$cat/etc/os-release
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID = ubuntu
ID_LIKE=debian
PRETTY_NAME = "Ubuntu 18.04.3 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

ubuntu can do most of the things you can do with WSL.
I usually try a lot of things with VirtualBox and VM (CentOS), but I need some memory.

WSL2 seems to work, but I haven't tried it.


2022-09-30 17:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.