8000 GitHub - guanglinlv/container-tools: enter linux container like garden or docker,dynamic mount volumes for running container.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

guanglinlv/container-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Name

Container-tools

Table of Contents

Intro

  • enter linux container like garden or docker.
  • dynamic mount volumes for running container

Prerequisites

  • nsenter

    wget https://www.kernel.org/pub/linux/utils/util-linux/v2.26/util-linux-2.26.2.tar.gz --no-check-certificate
    tar zxf util-linux-2.26.2.tar.gz
    cd util-linux-2.26.2
    ./configure --without-ncurses
    make LDFLAGS=-all-static nsenter
    cp nsenter /usr/bin/
  • nsattach

    nsattach is Fork of nsenter from util-linux with pseudo tty support for interactive usage.

  • Others

    • any one VM that is allow to access the container VM
    • create a garden container
    • create a docker container

Back To TOP

container-enter

./install.sh /usr/bin ```

  • enter-container

    • HELP
     container-enter --help
    
     Usage: container-enter OPTIONS
    
     -t,--type <container type>         the connecting container type,only support garden and docker currently.
     -i,--id   <container id>           the connecting container id.
     -u,--user [container user]         User to change to in the connecting container.
     -c,--command ["execute command"]   you can give some command that will run in specified container,You can specify multiple -c arguments.
    
     -h,--help   display this help and exit
    
    • login specify container on other VM
     ssh -t -i ~/.ssh/<VM-USER-PRIVATE-KEY> <VM-USER>@<VM-IP> LocalCommand=" container-enter --type <CONTAINER-TYPE> --id <CONTAINER-ID> --user <CONTAINER-USER>"
    • login specify container on the same VM
     container-enter --type <CONTAINER-TYPE> --id <CONTAINER-ID> --user <CONTAINER-USER>
    • run some command in continer
    container-enter --type <CONTAINER-TYPE> --id <CONTAINER-ID> --command "ls -al"

Back To TOP

container-mount-volumes

  • how to mount local volumes

    we can use container-mount-volumes dynamic mount local volumes for running container.

    • HELP
     container-mount-volumes --help
    
     Usage: container-mount-volumes OPTIONS
    
       -t,--type <container type>                    the connecting container type,only support garden and docker currently.
       -i,--id   <container id>                      the connecting container id
       -v,--volumes [volumes,host:container]         volumes which will be dynamic mount to specify container,You can specify multiple -v arguments.
       -c,--command ["execute command"]              you can give some command that will run in specified container,You can specify multiple -c arguments.
    
       -h,--help   display this help and exit
    
    • mount volumes for running container
    container-mount-volumes --type <CONTAINER-TYPE> --id <CONTAINER-ID> --volumes <HOST-PATH>:<CONT-PATH>
  • mount remote volumes

    we can use container-mount-volumes -c command dynamic mount remote volumes for running container.

container-mount-volumes --type --id --command "mkdir -p /testnfs;mount -t nfs :/home/nfs /testnfs" ```

Back To TOP

Reference

Back To TOP

Licence

Copyright (c) 2015, lvguanglin guanglinlv@gmail.com

All rights reserved.

About

enter linux container like garden or docker,dynamic mount volumes for running container.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0