This simple script allows to access docker container by entering the container number from the list.
$ sudo dokr
1 my_great_container
2 php_hello_world
3 java_test_app
4 my_website
Enter container number:
Install required python 3 packages.
pip3 install docker
You may need to install it with sudo
if you access your docker containers with sudo
.
Install the application
sudo cp dokr.py /usr/local/bin/dokr
sudo chmod a+x /usr/local/bin/dokr
dokr
You may need to run it with sudo
if you access your docker containers with sudo
.
dokr --all
If you want to filter the containers list, just edit the script /usr/local/bin/dokr
.
if 'php' in c.name or 'systemd' in c.name:
Replace php
and systemd
with a strings you want to use to filter the container names. You can add more conditions.
It's hard to develop without a mug of coffee, help me have the black liquid always available ☕.