inception

This README would normally document whatever steps are necessary to get your application up and running.


questions

  • ? what means mounted in "a file or directory on the host machine is mounted into a container" ?
  • ? why the volumes cannot be modify outside docker ?

nginx basics

  • sudo netstat -tulpn to print network connections and see if nginx is running
  • or : ps -ax | grep nginx
  • sudo nginx -s quit to stop it

Dockerfile basics

  • the container posess its own filesystem
  • we need to copy the files it uses inside this filesystem
  • we can do that with COPY

ressources

install and use docker and compose

remove old versions

  • sudo apt remove docker docker-engine docker.io containerd runc preparing directory
  • sudo apt update
  • sudo apt install ca-certificates curl gnupg lsb-release
  • sudo mkdir -p /etc/apt/keyrings
  • curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
  • echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null installing docker engine
  • sudo apt update
  • sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin check if installation worked
  • sudo docker run hello-world installing docker compose checked version on github release, see above
  • sudo curl -L "https://github.com/docker/compose/releases/download/2.10.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  • sudo chmod +x /usr/local/bin/docker-compose
  • sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose build and run a docker image
  • be in directory with a Dockerfile
  • sudo docker build --tag <name> .
  • sudo docker images to list images
  • sudo docker run <name>
  • sudo docker image rm -f <number-id> execute a docker-compose file
  • be in directory with a docker-compose.yml file
  • sudo docker-compose up

volumes vs bind mounts

  • bind mounts are normal files anywhere on the computer, that docker container can access with absolut path and modify. They can also be modified without docker, since they are juste files
  • volumes are only modifiable by docker, they don't need an absolut path, and they are not dependent of host architecture

tips

run without sudo on linux

Description
No description provided
Readme 2.9 MiB
Languages
Dockerfile 62.6%
Makefile 20.3%
Shell 15.4%
Assembly 1.6%
HTML 0.1%