Travelling Techie

Adventures in VMware

User Tools

Site Tools


Sidebar

Network Virtualization
Compute Virtualization
Storage Virtualization
Security
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

Commonly used Docker Commands

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 exec -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)

Troubleshooting/additional info

$ docker container inspect <container ID>
$ docker container inspect --format='{{json .Config}}' <container ID> | jq
$ docker service logs <service>

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>
docker_commands.txt · Last modified: 2019/12/21 13:05 by brandon