mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Improving Docker based Installation (#1194)
To be able to use 'vagrant ssh' from within the docker container, it is necessary to run within the host network context. Include a helper alias suggestion and a note about a current issue in passing arguments to vagrant options which impacts the 'vagrant ssh -c ...' syntax with an alternative.
This commit is contained in:
parent
5471caabe5
commit
441bcc24bf
@ -66,6 +66,8 @@ RUN for dir in boxes data tmp; \
|
||||
|
||||
FROM base as final
|
||||
|
||||
ENV VAGRANT_DEFAULT_PROVIDER=libvirt
|
||||
|
||||
COPY --from=build /vagrant /vagrant
|
||||
COPY entrypoint.sh /usr/local/bin/
|
||||
|
||||
|
31
README.md
31
README.md
@ -111,6 +111,12 @@ To get the image:
|
||||
docker pull vagrantlibvirt/vagrant-libvirt:latest
|
||||
```
|
||||
|
||||
Preparing the docker run, only once:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.vagrant.d/{boxes,data,tmp}
|
||||
```
|
||||
|
||||
Running the image:
|
||||
```bash
|
||||
docker run -it --rm \
|
||||
@ -119,10 +125,35 @@ docker run -it --rm \
|
||||
-v ~/.vagrant.d:/.vagrant.d \
|
||||
-v $(pwd):$(pwd) \
|
||||
-w $(pwd) \
|
||||
--network host \
|
||||
vagrantlibvirt/vagrant-libvirt:latest \
|
||||
vagrant status
|
||||
```
|
||||
|
||||
It's possible to define an alias in `~/.bashrc`, for example:
|
||||
```bash
|
||||
alias vagrant='
|
||||
mkdir -p ~/.vagrant.d/{boxes,data,tmp}; \
|
||||
docker run -it --rm \
|
||||
-e LIBVIRT_DEFAULT_URI \
|
||||
-v /var/run/libvirt/:/var/run/libvirt/ \
|
||||
-v ~/.vagrant.d:/.vagrant.d \
|
||||
-v $(pwd):$(pwd) \
|
||||
-w $(pwd) \
|
||||
--network host \
|
||||
vagrantlibvirt/vagrant-libvirt:latest \
|
||||
vagrant'
|
||||
```
|
||||
|
||||
Known issue of Docker based Installation: SSH command option cannot be used, so below command:
|
||||
```bash
|
||||
vagrant ssh master -c 'ls -la'
|
||||
```
|
||||
should be call below way:
|
||||
```bash
|
||||
vagrant ssh master -- 'ls -la'
|
||||
```
|
||||
|
||||
Note that if you are connecting to a remote system libvirt, you may omit the
|
||||
`-v /var/run/libvirt/:/var/run/libvirt/` mount bind. Some distributions patch the local
|
||||
vagrant environment to ensure vagrant-libvirt uses `qemu:///session`, which means you
|
||||
|
Loading…
Reference in New Issue
Block a user