Dockerfile reference (official)
set of Docker examples | GitHub | docker/doodle
install Docker on Ubuntu (official)
post install steps Docker (official)
Docker Install & set up (good)
Learn Docker in 7 easy Steps | Fireship (video)
Docker full intro | NetworkChuck (video)
GitHub Actions + Docker + Kubernetes (DigitalOcean)
Deploying to DigitalOcean With GitHub Actions
HTTP API Server | GitHub (good, with db migration)
install Docker Compose official
Using Portainer To Manage Your Docker Containers Easily (complete)
A list of commands | FreeCodeCamp
docker ps
: list all running containers on the system.
docker info
: give general info about docker.
docker images
: displays all images of docker.
docker inspect [IMAGE_NAME]
: get more about a specific image.
docker inspect [IMAGE_ID]
: get more about a specific image.
docker image rm [IMAGE_ID] -f
: remove the image directly. Here -f
forces the execution, because otherwise you would get an error if the image is referenced by more than 1 tag.
docker push ???
: command used to push (upload) a docker container to a container registry somewhere (docker hub, Amazon ECR...)
A docker-compose.yml
file is requiered to use, but is very easy to build. It make possible to set rules for multiple container sharing using volumes
. It also make it possible communication between containers with service
. See the Fireship video on the topic for a quick recap.
docker-compose build
: build a container from the docker-compose.yml
file.
docker-compose up [CONTAINER_NAME]
: run the specified container.
docker-compose down
: shut down all containers.
See on StackOverflow.
Docker Compose (herein referred to as compose) will use the Dockerfile if you add the build command to your project's docker-compose.yml
.
Your Docker workflow should be to build a suitable Dockerfile
for each image you wish to create, then use compose to assemble the images using the build
command.
@Cyril RICHARD
1/ Solution pour un dev seul : Docker c'est souvent un peu overkill, et ça dépend des habitudes de chacun mais ça reste exploitable. Pour la gestion des multiples services, un docker compose fait l'affaire. Pour centraliser la gestion des container: Portainer.
- Install Docker Engine
- Modify user rights
- Install Docker compose
check installation :
❮ onyr ★ kenzae❯ ❮ ~❯❯ docker --version
Docker version 19.03.13, build 4484c46d9d
❮ onyr ★ kenzae❯ ❮ ~❯❯ docker-compose --version
docker-compose version 1.27.4, build 40524192
docker
- Uninstall the Docker Engine, CLI, and Containerd packages:
$ sudo apt-get purge docker-ce docker-ce-cli containerd.io
- Images, containers, volumes, or customized configuration files on your host
are not automatically removed. To delete all images, containers, and
volumes:
$ sudo rm -rf /var/lib/docker
docker-compose
To uninstall Docker Compose if you installed using curl
:
sudo rm /usr/local/bin/docker-compose
What is Portainer :
Portainer allows you to easily build, manage and maintain containerized environments without the need to know CLI, YAML or any other complex syntax. It makes life simple, but not at the expense of functionality or capability. In fact, quite the opposite
Got permission denied while trying to connect to the Docker daemon socket
Solution available here.
newgrp docker
: load new groups policy (allows to skip reboot. Need to be used on every terminal where the docker
command will run.
❮ onyr ★ kenzae❯ ❮ cheers2019❯❯ docker ps
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied
❮ onyr ★ kenzae❯ ❮ cheers2019❯❯ sudo groupadd docker
[sudo] password for onyr:
groupadd: group 'docker' already exists
❮ onyr ★ kenzae❯ ❮ cheers2019❯❯ sudo usermod -aG docker $USER
❮ onyr ★ kenzae❯ ❮ cheers2019❯❯ groups
onyr adm dialout cdrom sudo audio dip plugdev lpadmin sambashare
❮ onyr ★ kenzae❯ ❮ cheers2019❯❯ groups onyr
onyr : onyr adm dialout cdrom sudo audio dip plugdev lpadmin sambashare docker
❮ onyr ★ kenzae❯ ❮ cheers2019❯❯ newgrp docker
❮ onyr ★ kenzae❯ ❮ cheers2019❯❯ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES