Rex::Box::Docker(3)
π Rex::Box::Docker(3) β the perl doc you actually wanna read π³
okay so bestie, you found the Rex::Box::Docker page in the perl docs (User Contributed Perl Documentation, no less π) and you're like "what is this". Don't worry, I got you. This is the Rex/Boxes module for using Docker Images, and yeah β you gotta have dockerd installed first, no cap. π
π¦ NAME
Rex::Box::Docker β the Rex/Boxes Docker Module, fr fr.
β¨ DESCRIPTION
This is a Rex/Boxes module to use Docker Images. That's the whole vibe. But listen β you need to have dockerd installed. Like, actually installed and running. Not optional, bestie. π
π EXAMPLES
So say you wanna use this module inside your Rexfile β here's exactly how, no guessing:
use Rex::Commands::Box;
set box => "Docker";
task "prepare_box", sub {
box {
my ($box) = @_;
$box->name("mybox");
$box->url("http://box.rexify.org/box/ubuntu-server-12.10-amd64.tar.gz");
$box->url("debian:latest");
$box->network(1 => {
name => "default",
});
$box->auth(
user => "root",
password => "box",
);
$box->setup("setup_task");
};
};
Look at that. Two url calls, a network with name => "default", auth with user => "root" and password => "box", and a setup pointing at "setup_task". Icons only. β¨
Now if you're more of a YAML girlie (and honestly, same), here's the template π:
type: Docker
vms:
vmone:
url: debian:latest
setup: setup_task
And then in your Rexfile you just do this and it slays:
use Rex::Commands::Box init_file => "file.yml";
task "prepare_vms", sub {
boxes "init";
};
The init_file => "file.yml" is doing the heavy lifting there, just so we're clear. π
π METHODS
First things first: see also the Methods of Rex::Box::Base. This module inherits all methods of it. So if you can't find what you need here, that's where it's at. iykyk π«Ά
π
new(name => $vmname)
Constructor if used in OO mode. That's object-oriented mode, for the uninitiated. πΈ
my $box = Rex::Box::Docker->new(name => "vmname");
π§ memory($memory_size)
Sets the memory of a VM in megabyte. Yes, megabyte. Singular. That's what it says, bestie. β
π₯ info
Returns a hashRef of vm information. A hashRef, not a hash. Don't come for me, I'm just the messenger. π
π ip
This method return the ip of a vm on which the ssh daemon is listening. That's the ip you want if you're trying to ssh in β it's giving main character energy. π
lowkey important: the ssh daemon is the thing listening, so if you're not running one, this ip isn't gonna do you any favors π
aaaand that's the whole page, bestie. Not me being obsessed with how short and sweet this one is π
Signed off with love: this page is perl v5.42.3, dated 2023-08-05, and it's Rex::Box::Docker(3) β catch you in the group chat ππ
π¦ where this page comes from
- nixos 26.05: perl5.42.3-Rex 1.14.3
- nixpkgs unstable: perl5.42.3-Rex 1.14.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms