Git Product home page Git Product logo

dopecker's Introduction

Dopecker

This is very usuful shell command library for the Docker container work.

Requirements

Getting started

Quick start

$ git clone https://github.com/ontheroadjp/dopecker.git
$ source dopecker/dopecker

Add below into ~/.bashrc or ~/.bash_profile to enable afrer restart computer

if [ -f /path/to/dopecker/dopecker ]; then
  source /path/to/dopecker/dopecker
fi

Usage

Just type command and hit return key. no options, no arguments.

Commands

get docker container information

$ DD			# show list containers
$ DDimages		# show list images
$ DDid			# show specific container's id
$ DDip			# show specific container's IP Address
$ DDvol			# show specific container's mounted volumes
$ DDenv			# show specific container's environment variables
$ DDhosts		# show specific container's /etc/hosts file
$ DDps			# execute docker ps
$ DDpsa			# execute docker ps -a
$ DDi			# execute docker images
$ DDstats		# execute docker stats
$ DDtop			# execute docker top
$ DDlogs		# execute docker logs
$ DDlogsf		# execute docker logs -f
$ DDhistory		# execute docker history
$ DDinspect		# execute docker inspect

control docker container

$ DDstart		# start specific container
$ DDstop		# stop specific container
$ DDrm			# remove specific container
$ DDrmi			# remove specific image
$ DDstopa		# stop all of running container
$ DDnone		# remove all <none> images
$ DDreset		# stop and remove all of the container

connect into docker container

$ DDbash		# connect into specific container with bash command
$ Ddmysql		# connect into specific container with mysql command

Usage examples

Example) Using DD command which shows list of containers

  1. Type command.

    $ DD
    
  2. Then, show list containers like this.

    --------------------------------
    <RUNNING>
    1: c40d6be871ff      nutsp/php:5.6-apache     toybox_www.starton.jp-php_1
    2: ea890b60fc08      mariadb                  toybox_www.starton.jp-php-db_1
    3: 3abb0a3ea952      wordpress                toybox_wordpress.docker-toybox.com-wordpress_1
    4: c5d23808608f      mariadb                  toybox_wordpress.docker-toybox.com-wordpress-db_1
    5: 3b57f305d320      jwilder/nginx-proxy      toybox_proxy_1
    --------------------------------
    <STOPPED>
    1: 0e1bc8616510      wordpress                toybox_blog.docker-toybox.com-wordpress_1
    2: 60e31d8ec558      mariadb                  toybox_blog.docker-toybox.com-wordpress-db_1
    

Example) Using Ddip command which shows IP Address of specific container

  1. Type command.

    $ DDip
    
  2. Then, open peco with running containers

    QUERY>                                                                                    IgnoreCase [1/1]
    c40d6be871ff        nutsp/php:5.6-apache   "/entrypoint.sh apac   15 hours ago        Up 15 hours         
    ea890b60fc08        mariadb                "/docker-entrypoint.   15 hours ago        Up 15 hours
    3abb0a3ea952        wordpress              "/entrypoint.sh apac   22 hours ago        Up 22 hours
    c5d23808608f        mariadb                "/docker-entrypoint.   22 hours ago        Up 22 hours
    3b57f305d320        jwilder/nginx-proxy    "/app/docker-entrypo   22 hours ago        Up 22 hours
    
  3. select container

  4. Finally, show IP Address your selected container

    172.17.1.104
    

Example) Using command in others

You can also use several commands in shell script.

$ docker run -d -e PMA_HOST=$(DDip) -p 8080:80 phpmyadmin/phpmyadmin

This one is going to up phpMyAdmin container that is connected to specific container. You can access it http://xxx.xxx.xxx.xxx:8080.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.