Tuesday, January 17, 2017

Login to a running docker container


How to login to a running container?

First get the docker id using this command:
 $ docker ps
CONTAINER ID ...
feb8867e1fd9 ...

Then, run bash process inside the corresponding container id.
$ docker exec -it  <feb8867e1fd9> bash

Where options:
             -i interactive
             -t allocate a pseudo-TTY.

[root@feb8867e1fd9 /]# [root@feb8867e1fd9 /]# 

We are inside the container now :)

Tuesday, January 10, 2017

stop disable firewall in Centos 7.0




stop firewall
[store1@outspokencentos ~]$ systemctl stop firewalld

To disable it permanently
[store1@outspokencentos ~]$ systemctl disable firewalld


create pause between commands - bash scripting

create pause between commands in a script:

================================
You could create a function for it:

pause(){
 read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n'
}

Then you can use this everywhere in your script:

pause
================================



Sunday, January 1, 2017

rpm - find whether a package of specific name installed and find its contents


$ rpm -qa | grep vim
vim-minimal-7.4.160-1.el7_3.1.x86_64
$
$ rpm -ql vim-minimal-7.4.160-1.el7_3.1.x86_64
/etc/virc
/usr/bin/ex
/usr/bin/rvi
/usr/bin/rview
/usr/bin/vi
/usr/bin/view
/usr/share/man/man1/ex.1.gz
/usr/share/man/man1/rvi.1.gz
/usr/share/man/man1/rview.1.gz
/usr/share/man/man1/vi.1.gz
/usr/share/man/man1/view.1.gz
/usr/share/man/man1/vim.1.gz
/usr/share/man/man5/virc.5.gz
$