Voici une liste des commandes rapide pour Docker.
Here is a quick list of commands for Docker.
---------------------------------------------------------------------------------
# Run a container
docker run ubuntu /bin/echo "Hello word"
# Running an interactive shell
docker run -i -t ubuntu /bin/bash
# Start Container as a daemon
docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"
# Show container running
docker ps
# nat port-Host -> Container
docker run -d -p 80:5000 training/webapp python app.py
# Show container logs
docker logs -f name_container
# container top
docker top name_container
# Remove container
docker rm name_container
# Start Stop container
docker stop / start name_container
# Listing images on the host
docker images
# Download images
docker pull centos
# Docker search images
docker search sinatra
# Updating and committing an image
docker commit -m "Added json gem" -a "Kate Smith" 0b2616b0e5a8 ouruser/sinatra:v2
# Set name container
docker run -d -P --name web training/webapp python app.py
# Show networks
docker network ls
# Create Bridge network
docker network create -d bridge my-bridge-network
# Show network detail
docker network inspect my-bridge-network
docker inspect --format='{{json .NetworkSettings.Networks}}' name_container
# Show IP address Container
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' web
# Connect networks
docker network connect my-bridge-network web
# Attach Container to network
docker network connect my-bridge-network web
# Adding a data volume
docker run -d -P --name web -v /webapp training/webapp python app.py
#
Mount a host directory as a data volumedocker run -d -P --name web -v /src/webapp:/webapp training/webapp python app.py