Enable checking of all commands. The execution of shell script will be aborted if one command returns non-zero status code. Examples:
# true; echo $?
0
# false; echo $?
Khi shell script nhận được một Signal, script có thể thực hiện một trong ba actions:
Các actions trên đúng ngoại trừ trường hợp 3 signals:
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
Định nghĩa VOLUME trong Dockerfile sẽ:
/var/lib/docker/volumes/[container_id]/_data/
Note: _data
được gọi là "mount point"Run container với lệnh: docker run --rm image
Khi container được run, ta có thể check volume được tạo bởi container bằng câu lệnh: docker volume ls
Khi container exited, volume sẽ mất do ta định nghĩa cờ --rm
ở câu lệnh docker run
, do đó container và volume của nó sẽ được remove hoàn toàn.
Get the latest version of Docker Compose on Docker Compose release page
To install
curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
Each Docker Image was built by stacking different Image Layers, each Image Layer represents an instructions in Image's dockerfile.
When we create a new container, a writable layer is placed on top on underlying layers. We can call this layers is Container Layer. All changes made in container (such as writing to files, modifing files or delete files) are written to this Container Layer.
#!/bin/bash | |
##################################################### | |
# Name: Bash CheatSheet for Mac OSX | |
# | |
# A little overlook of the Bash basics | |
# | |
# Usage: | |
# | |
# Author: J. Le Coupanec | |
# Date: 2014/11/04 |
Sẽ có 2 kiểu program trong Go:
src
: Contains Go source files.pkg
: Contains package objects# Ubuntu 14.04 don't have nsenter - the straight forward way required me to install build tools and etc. | |
# I preferred to keep the system clean and install nsenter in a container and then copy the command to the host | |
# Note - its also possible to run nsenter from a container (didn't tried) https://github.com/jpetazzo/nsenter | |
# start a container | |
docker run --name nsenter -it ubuntu:14.04 bash | |
## in the docker | |
apt-get update | |
apt-get install git build-essential libncurses5-dev libslang2-dev gettext zlib1g-dev libselinux1-dev debhelper lsb-release pkg-config po-debconf autoconf automake autopoint libtool |