Skip to content

Instantly share code, notes, and snippets.

@higebu
Last active March 30, 2022 21:12
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save higebu/f35fdd27d085b618a872a8b46c625e2e to your computer and use it in GitHub Desktop.
Save higebu/f35fdd27d085b618a872a8b46c625e2e to your computer and use it in GitHub Desktop.
Docker on VyOS 1.2
* Vagrantfile
```
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure('2') do |config|
config.vm.box = 'vyos/current'
config.vm.provider :libvirt do |libvirt|
libvirt.storage :file, size: '20G'
end
config.vm.provision 'shell', inline: <<-SHELL
sudo mkfs.ext4 /dev/vdb
sudo mkdir /mnt/docker-data
echo '/dev/vdb /mnt/docker-data ext4 defaults 0 0' | sudo tee -a /etc/fstab
sudo mount /mnt/docker-data
sudo mkdir /etc/docker
echo '{"data-root": "/mnt/docker-data","storage-driver": "overlay"}' | sudo tee /etc/docker/daemon.json
source /opt/vyatta/etc/functions/script-template
configure
set system package repository jessie components 'main contrib non-free'
set system package repository jessie distribution jessie
set system package repository jessie url 'http://deb.debian.org/debian'
commit
save
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
set system package repository docker components stable
set system package repository docker distribution jessie
set system package repository docker url https://download.docker.com/linux/debian
commit
save
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo apt update
sudo apt install -y docker-ce
set system login user vyos group docker
commit
save
SHELL
end
```
* docker info
```
vyos@vyos:~$ docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.12.1-ce
Storage Driver: overlay
Backing Filesystem: extfs
Supports d_type: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9b55aab90508bd389d7654c4baf173a981477d55
runc version: 9f9c96235cc97674e935002fc3d78361b696a69e
init version: 949e6fa
Kernel Version: 4.14.26-amd64-vyos
Operating System: Debian GNU/Linux 8 (jessie)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 489.6MiB
Name: vyos
ID: RPQC:225S:FULT:3434:AASR:CASH:NS7I:OQ4K:AYA2:DQMG:AGFM:CB3I
Docker Root Dir: /mnt/docker-data
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
```
* hello world
```
vyos@vyos:~$ docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
ca4f61b1923c: Pull complete
Digest: sha256:97ce6fa4b6cdc0790cda65fe7290b74cfebd9fa0c9b8c38e979330d547d22ce1
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment