Sign inSign up

riepel/netdb-cli

By riepel

Updated almost 2 years ago

A ready-to-use NetDB CLI

Image
0

237

riepel/netdb-cli repository overview

NetDB CLI

This is a ready-to-use NetDB CLI. Just run it, kinit, and start using the CLI:

% docker run --name cli --rm -it riepel/netdb-cli
You are now running the NetDB CLI virtual machine YOLO. Enjoy!
yolo% kinit <sunetid>
Password for <sunetid>@stanford.edu:
yolo% netdb node info example
Node "example.stanford.edu" ...

         name: example
         type: Node (Host)
        state: Exempt
        group: Unix
   department: IT Services
     location: Sweet Hall (03-420)
         room: Server Room
          cpu: UNKNOWN any
       op-sys: UNKNOWN
   interfaces:
    1)  hw-addr: baba.cafe.deed  dhcp  roam
        ip-addr: 169.254.132.100
administrator: Elroy Jetson ([email protected])
      comment: Reserved for use in examples.
      created: Mar-24-1998 11:32 PM by Russ Allbery ([email protected])
      updated: Jun-10-2020 12:12 AM by Rob Riepel ([email protected])
Keeping it around

If you use the CLI now and then during the day it's nice to have it around and ready without having to start up the container and run kinit every time. To accomplish that, start it detached using the -d option and run kinit just once:

% docker run --name cli --rm -it -d riepel/netdb-cli
abdde1c733af8db1290085249321cfdee6a3dd400447b08a0c70998b0aab97fe
% docker exec -it cli kinit <sunetid>
Password for <sunetid>@stanford.edu:

Then you can issue CLI commands using the docker command:

% docker exec -it cli netdb node info example
Node "example.stanford.edu" ...

         name: example
         type: Node (Host)
        state: Exempt
        group: Unix
   department: IT Services
     location: Sweet Hall (03-420)
         room: Server Room
          cpu: UNKNOWN any
       op-sys: UNKNOWN
   interfaces:
    1)  hw-addr: baba.cafe.deed  dhcp  roam
        ip-addr: 169.254.132.100
administrator: Elroy Jetson ([email protected])
      comment: Reserved for use in examples.
      created: Mar-24-1998 11:32 PM by Russ Allbery ([email protected])
      updated: Jun-10-2020 12:12 AM by Rob Riepel ([email protected])

Or you can run a shell on the container and issue CLI commands from there:

% docker exec -it cli bash
You are now running the NetDB CLI virtual machine YOLO. Enjoy!
yolo% netdb node info example
Node "example.stanford.edu" ...

         name: example
         type: Node (Host)
        state: Exempt
        group: Unix
   department: IT Services
     location: Sweet Hall (03-420)
         room: Server Room
          cpu: UNKNOWN any
       op-sys: UNKNOWN
   interfaces:
    1)  hw-addr: baba.cafe.deed  dhcp  roam
        ip-addr: 169.254.132.100
administrator: Elroy Jetson ([email protected])
      comment: Reserved for use in examples.
      created: Mar-24-1998 11:32 PM by Russ Allbery ([email protected])
      updated: Jun-10-2020 12:12 AM by Rob Riepel ([email protected])

yolo%

When you no longer need the detached CLI container tell docker to stop it:

% docker stop cli
Working with files

"Ah," you say, "I want to use a list of nodes with the CLI --input option or run a batch of commands from a file using the --batch option. How do I get to my files in your fancy container?"

We're glad you asked, and it's simple. Just start the container with the volume option, -v, to map your local directory with the files to the container home directory, /netdb.

% pwd
/tmp/files
% ls
nodes
% cat nodes
argus
example
% docker run --name cli --rm -it -v /tmp/files:/netdb riepel/netdb-cli
You are now running the NetDB CLI virtual machine YOLO. Enjoy!
yolo% ls
nodes
yolo% cat nodes
argus
example

Of course this works with a detached container too:

% docker run --name cli --rm -it -v /tmp/files:/netdb -d riepel/netdb-cli
ede9cb8386fd349373c0b2f778d5958833c2894ae174b7dbe0b3053da1fb2ab0

% docker exec -it cli cat nodes
argus
example

The mapping is live, not a snapshot. Files created on local system or in the container show up immediately in both places.

% pwd
/tmp/files
% ls
nodes
% touch batch
% ls
batch	 nodes

% docker exec -it cli ls -l
total 4
-rw-r--r-- 1 root root  0 May  8 13:36 batch
-rw-r--r-- 1 root root 14 May  8 13:30 nodes
share and enjoy

Tag summary

Content type

Image

Digest

sha256:1584f6922

Size

142 MB

Last updated

almost 2 years ago

docker pull riepel/netdb-cli