Tri Nguyen
Tri Nguyen

Intro

In this post I would like to list some useful commands for using Docker in Linux.

Dockers

docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }} {{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' | sed 's#^/##';
docker system prune --volumes
version: '3.5'

services:
  network_default:
    image: hello-world:latest
networks:
  default:
    driver: bridge
    ipam:
      driver: default
      config:
      - subnet:  192.168.0.0/16

and then use the network for the image as following

networks:
  default: 
    external:
      name: network_default
docker save -o ./{filename}.tar {image_name}

The image_name can be get through

docker images
docker load -i {filename}.tar

Linux

du -h --max-depth=1
sudo lsof -i -P -n
sudo firewall-cmd --list-all
sudo apt-get update      
sudo apt-get upgrade      
sudo apt-get dist-upgrade  
sudo apt-get autoremove
sudo reboot
landscape-sysinfo
sudo passwd root
sudo vi /etc/ssh/sshd_config

Set following properties.

PermitRootLogin yes
PasswordAuthentication yes

Restart SSH.

sudo service sshd restart
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d {domain}
nc -vz {IP_OR_COMPUTER_NAME} 24224

Comments

If you have any question, you can start a new discussion.