General Docker Information
====================================================================================
To preface this page; I personally recommend trying out Portainer, which is essentially a web GUI for Docker - it's great. Portainer even lives in a docker container itself.
Regarding images and container management; the contents of this page are great if you're working with a small number of containers that are being installed/setup as a one-off then this is all fine, however, if you're launching containers for applications that need to be updated, changed/customised etc then you're probably best off taking a look at the Docker Compose page.
====================================================================================
Installation
https://docs.docker.com/engine/install/
1. Configure Docker repo (See above link)
2. Install Docker CE (Community Edition)
apt install docker.io
Alternatively, there is a script to perform an automated installation of Docker; Again, see above link.
====================================================================================
Commands & Usage
-----------------------------------------------------------------------------------------------------------------------------
Managing Containers
List Docker processes/containers (running and stopped)
docker ps -a
Start a container
docker start containername
stop a container
docker stop containername
Delete a container
docker rm containername
Check container performance metrics
docker stats containername
-----------------------------------------------------------------------------------------------------------------------------
Adding new docker images
Docker has their own 'marketplace' of sorts for docker images:
To install a new docker image
docker pull container-name
List installed Docker images
docker images
Search locally installed images, and search Docker repository for available images
docker search name
Launching Containers
Basic launch for a container based on an image
docker run --name containername -it imagename
There are lots and lots of options available for the docker run command:
Starting an instance with this method will push your shell into the container itself. To exit the container (continues running):
ctrl+p ctrl+x
To connect to a docker image:
docker attach containername
To connect to a docker image CLI:
docker exec -it containername bash
====================================================================================
====================================================================================