Discover Docker
You can use docker on TSP Lab machines
- Connect to a machine in B313 (ssh b313-01.int-evry.fr to b313-12.int-evry.fr) or 3A401 lab (ssh 3a401-01.int-evry.fr to 3a401-12.int-evry.fr).
- Test docker commands (see below).
Alternatively, you can configure docker on your own machine
Install docker engine
-
Documentation on how to install Docker.
Look at https://docs.docker.com/engine/installation/ for the instructions corresponding to your OS.
The following should work on Debian or Ubuntu systems, but pay attention to differences in architecture (64 bits, ...).sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg2 \ software-properties-common curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/debian \ $(lsb_release -cs) \ stable" sudo apt-get update sudo apt-get install docker-ce -
Check your installation:
docker --version
On YOUR OWN machine, at this step, you may want to launch docker directly on your OS. In that case, after starting docker, jump to step 2.
Allow docker to start on boot
sudo systemctl enable docker
Start docker without rebooting
sudo systemctl start docker
To disable this behavior
sudo systemctl disable docker
To stop docker service
sudo systemctl stop docker
Alternatively, you can start docker manually. When you start Docker this way, it runs in the foreground and sends its logs directly to your terminal.
sudo dockerd
To stop Docker when you have started it manually
Ctrl+C in your terminal
Discover and manipulate docker commands
- See documentation on docker CLI commands: https://docs.docker.com/engine/reference/commandline/cli/
-
Display information on the syntax of commands:
docker help
-
Download and run a "Hello World" example:
docker run hello-world
-
List available images:
docker images
-
List running containers:
docker ps
-
Inspect a container:
docker inspect REPLACE_WITH_NAME_OF_CONTAINER
-
Show only the ports exposed by a container:
docker port REPLACE_WITH_NAME_OF_CONTAINER
-
Display the logs of a container:
docker logs -f REPLACE_WITH_NAME_OF_CONTAINER
-
Search docker hub for ready-to-use images:
docker search javadocker search glassfish
-
List all the locally cached images:
docker images
-
Remove an image from local cache:
docker rmi REPLACE_WITH_NAME_OF_IMAGE
-
Remove unwanted and unnamed images from local cache:
docker rmi $(docker images -q -f dangling=true)
-
Stop a container:
docker stop REPLACE_WITH_NAME_OF_CONTAINER
-
The container can be started again:
docker start REPLACE_WITH_NAME_OF_CONTAINER
-
List all containers (active or not):
docker ps -a
-
List the processes running in a container:
docker top REPLACE_WITH_NAME_OF_CONTAINER
-
Remove a container:
docker rm REPLACE_WITH_NAME_OF_CONTAINER