run in the terminal:
curl -fsSL htpps://get.docker.com/ | shIt will download the latest version (not recommended for deployment in your server, you should stay on a stable version)
Check the version
docker --versionrun in the terminal:
docker run hello-worldIf it's the first time running the hello-world docker will pull the image from docker hub
after it's ready it should print
Hello from Docker.
- To check the images just run
dock images- To check running containers run
docker ps- To check all containers run
docker ps -a- to run an interactive terminal of a container
docker run -ti yourimagename- to run the container in the background
docker run -d yourimagename- choose the version of image
docker run yourimagename:version- exiting the container
Press ctrl + d
- exit the container, but keep it running
press ctrl+p+q
- enter in a running container
docker attach containerID- create container without executing it
docker create imagename- stopping a container
docker stop containerID- pausing container
docker pause containerID- unpausing container
docker unpause containerID- container stats
docker stats containerID- container processes
docker top containerID- container logs
docker logs containerID- remove container
docker rm containerID