Travelling Techie

Adventures in VMware

User Tools

Site Tools


Sidebar

Network Virtualization
Compute Virtualization
Storage Virtualization
Cloud
Containers
Operating Systems
Automation
Tools
VMware Classes
Other Classes
Other

Tags

Recent Changes

About The Author

Brandon Neill is a VMware Certified Instructor and Consultant. He specializes in NSX and vRealize Automation. In addition to teaching Official VMware Classes, he provides contract training and consulting services.

docker_commands

This is an old revision of the document!


Commonly used Docker Commands

Installing Docker on Centos

# yum install yum-utils device-mapper-persistent-data lvm2
# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# yum install docker-ce docker-ce-cli containerd.io
  • Install jq
# yum install epel-release -y
# yum install jq -y
  • Start Docker service
# systemctl enable docker
# systemctl start docker
  • Post Installation Steps
# groupadd docker //may already exist
# user mod -aG docker $USER
  • OPTIONAL Install Networking tools
# yum install nc tcpdump curl

Basic Docker Commands

Start a container, list all containers, run a command inside a container, kill it.

$ docker container run centos:7 
$ docker container ls -a
$ docker container exec <container ID> ps -ef
$ docker container rm <container ID>
$ docker container start <container ID> //-a to attach
$ docker container top <container ID>

Interactive Containers

$ docker container run -it centos:7 bash
$ docker container run -it <container ID> bash

Listing Containers

$ docker container ls -a --no-trunc
$ docker container ls -a -q  //only ID
$ docker container ls -a --filter "exited=0"
$ docker container rm -f $(docker container ls -aq)
$ docker container inspect <container ID>
$ docker container inspect --format='{{json .Config}}' <container ID> | jq

Building Images

$ docker container diff <container ID>
$ docker container commit <container ID>  mycontainer:1.0
$ docker image ls

Networking

$ docker network ls 
$ docker network inspect <network name> g
$ docker network create --driver <driver> <network name> \\creates a new network using the specified driver
$ docker container run --net=mynetwork centos 
$ docker network connect <network name> <container name or id>

search?q=commands&amp;btnI=lucky

docker_commands.1575500802.txt.gz · Last modified: 2019/12/04 18:06 by brandon