4.1 KiB
4.1 KiB
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 -tulpnto print network connections and see if nginx is running- or :
ps -ax | grep nginx sudo nginx -s quitto 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
- download alpine linux
- dockerhub alpine image
- docker glossaire
- Dockerfile syntaxe
- determine the parent image
- docker image from scratch
- build context and image context
- pid1 docker problem
install and use docker and compose
- how to install docker engine
- github releases
- install last version of compose manually
- install manually SO discussion
- the version installed with apt is 1.17.1, way out of date
remove old versions
sudo apt remove docker docker-engine docker.io containerd runcpreparing directorysudo apt updatesudo apt install ca-certificates curl gnupg lsb-releasesudo mkdir -p /etc/apt/keyringscurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpgecho "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/nullinstalling docker enginesudo apt updatesudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugincheck if installation workedsudo docker run hello-worldinstalling docker compose checked version on github release, see abovesudo curl -L "https://github.com/docker/compose/releases/download/2.10.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composesudo chmod +x /usr/local/bin/docker-composesudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-composebuild and run a docker image- be in directory with a Dockerfile
sudo docker build --tag <name> .sudo docker imagesto list imagessudo 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
- docker doc: use volumes
- docker doc: use bind mounts
- comparison volume vs bind mounts
- fundamentals use of volumes and bind mounts
- how volumes and bind mounts are really differents
- 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