Skip to content

cuongndc/docker

Repository files navigation

docker

Explore 🐳 Docker

cheat sheet

installation

  • update your existing list of packages
$ sudo apt update
  • install a few prerequisite packages which let apt use packages over HTTPS
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
  • add the GPG key for the official Docker repository to your system
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  • add the Docker repository to APT sources
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
  • update the package database with the Docker packages from the newly added repo
sudo apt update
  • make sure you are about to install from the Docker repo instead of the default Ubuntu repo
$ apt-cache policy docker-ce
  • install Docker
$ sudo apt install docker-ce
  • docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running
$ sudo systemctl status docker

(Optional) executing the Docker Command Without Sudo: Post-installation steps for Linux

$ sudo usermod -aG docker ${USER}
# log out and log back in so that your group membership is re-evaluated

install Docker Compose

container

Docker file

  • RUN : Để thực thi một câu lệnh nào đó trong quá trình build images.
  • CMD : Để thực thi một câu lệnh trong quá trình bật container. Mỗi Dockerfile chỉ có một câu lệnh CMD, nếu như có nhiều hơn một câu lệnh CMD thì chỉ có câu lệnh CMD cuối cùng được sử dụng.

Một câu hỏi đặt ra là nếu tôi muốn khởi động nhiều ứng dụng khi start container thì sao, lúc đó hay nghĩ tới ENTRYPOINT

  • ENTRYPOINT: Để thực thi một số câu lệnh trong quá trình start container, những câu lệnh này sẽ được viết trong file .sh.

documents

😋 Awesome

Releases

No releases published

Packages

No packages published