start docker with customer system name and hostname

docker run –name david -h david-01 -it david/c6nodepm2yo /bin/bash nJoy 😉 shows : docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f4da454e156e david/c6nodepm2yo “/bin/bash” 12 seconds ago Exited (0) 3 seconds ago david d5ec5101ba52 david/centos6:node “/bin/bash” 27 hours ago Up 26 hours 0.0.0.0:8000->80/tcp jovial_borg and when connected : [root@david-01 /]#

starting a machine in Docker with ports

docker run -p 800:80 -p 2222:22 -p  4443:443  -it 68715929d32a  /bin/bash If ports do not work check : sysctl net.ipv4.ip_forward if  you get: net.ipv4.ip_forward = 0 then issue : sysctl -w net.ipv4.ip_forward=1 net.ipv4.ip_forward = 1if you get the error :   docker: Error response from daemon: driver failed programming external connectivity on endpoint amazing_williams (44e256a6039741b20e4124800702d9794d69fb6be9da71ba25059de4dd527121):…

Docker log files

Ubuntu – /var/log/upstart/docker.log Boot2Docker – /var/log/docker.log Debian, GNU/Linux – /var/log/daemon.log CentOS6 – /var/log/daemon.log | grep docker Fedora – journalctl -u docker.service OpenSuSE – journalctl -u docker.service on Centos 7 journalctl -u docker.service nJoy 😉

Docker Remote API on CentOS

After installing Docker on CentOS we need to Docker remote API port on CentOS. $ cat /etc/sysconfig/docker other_args="" Edit the file /etc/sysconfig/docker as below. other_args="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock" After that, restart docker and try to access the host from another host. $ sudo /etc/init.d/docker restart … $ curl $hostname:4243/images/json … For a systemd based Distro…