DOCKER(1) Docker User Manuals DOCKER(1) (NAME) docker-build - Dockerfile (SYNOPSIS) docker build [--add-host[=[]]] [--build-arg[=[]]] [--cache-from[=[]]] [-c|--cpu-shares[=0]] [--cgroup-parent[=CGROUP-PARENT]] [--help] [--iidfile[=IIDFILE]] [-f|--file[=PATH/Dockerfile]] [-squash] Experimental [--force-rm] [--isolation[=default]] [--label[=[]]] [--no- cache] [--pull] [--compress] [-q|--quiet] [--rm[=true]] [-t|--tag[=[]]] [-m|--memory[=MEMORY]] [--memory-swap[=LIMIT]] [--network[="default"]] [--shm-size[=SHM-SIZE]] [--cpu-period[=0]] [--cpu-quota[=0]] [--cpuset- cpus[=CPUSET-CPUS]] [--cpuset-mems[=CPUSET-MEMS]] [--target[=[]]] [--ulimit[=[]]] PATH | URL | - (DESCRIPTION) Dockerfile PATH . Docker . ADD Dockerfile . : Docker . Docker CLI (context) . CLI "Sending build context to Docker daemon" . URL tarball Dockerfile Docker . Dockerfile . Git URL clone . (OPTIONS) -f, --file PATH/Dockerfile Dockerfile . . URL tarball Git . (build context) . Dockerfile . --squash true|false (Experimental Only) (squash). . Dockerfile . (build cache) . : . : ( ) . --add-host [] IP ( host=ip host:ip) /etc/hosts. hostname=ip hostname:ip . --add-host . --build-arg variable buildarg. http_proxy : --build-arg=http_proxy="http://some.proxy.url" . buildargs () RUN Dockerfile Dockerfile . . buildargs: --cache-from "" . --force-rm true|false . false . --isolation "default" . --label label --no-cache true|false . false . --iidfile "" (ID) --help --pull true|false (pull). false . --compress true|false gzip. false . -q, --quiet true|false . false . --rm true|false . true . -t, --tag "" ( ) . docker-tag(1) . -m, --memory MEMORY --memory-swap number[S] (swap) S b () k () m () g () . --memory . --memory . --memory . -1 . --network type RUN . : none bridge host container:. . bridge . --shm-size SHM-SIZE /dev/shm. . number 0 . b () k () m () g () . . 64m . -c, --cpu-shares 0 ( ). . << >> . : cat /sys/fs/cgroup/cpu/cpu.shares 1024 . -c --cpu- shares . Container CPU share Flag {C0} 60% of CPU --cpu-shares 614 (614 is 60% of 1024) {C1} 40% of CPU --cpu-shares 410 (410 is 40% of 1024) (CPU-intensive) . . . --cpu-shares 1024 --cpu-shares 512 . . --cpu-shares 1024 . . . . Container CPU share Flag CPU time {C0} 100% --cpu-shares 1024 33% {C1} 50% --cpu-shares 512 16.5% {C2} 50% --cpu-shares 512 16.5% {C4} 100% --cpu-shares 1024 33% . . . {C0} --cpu-shares 512 {C1} --cpu-shares 1024 : PID container CPU CPU share 100 {C0} 0 100% of CPU0 101 {C1} 1 100% of CPU1 102 {C1} 2 100% of CPU2 --cpu-period 0 (CFS) . . . --cpu-quota 0 (CFS) . . . --cpuset-cpus CPUSET-CPUS (0-3, 0,1). --cpuset-mems CPUSET-MEMS (MEM) (0-3, 0,1). NUMA . (0-3) --cpuset-mems 0,1 . --cgroup-parent CGROUP-PARENT cgroup cgroup . cgroups init . cgroup . --target "" (target build stage). --ulimit [] ulimit ulimit Setting ulimits in a container : (EXAMPLES) Dockerfile (Building an image using a Dockerfile located inside the current directory) build Dockerfile : docker build . . --rm false . docker build --rm false . Dockerfile . mongo Dockerfile MongoDB . httpd Dockerfile Apache . . COPY ADD Dockerfile . : tar ( ) tar ADD . (Building an image and naming that image) . a-z0-9-_. . . -t/--tag . : : docker build -t myimage . ( ":" ). JBoss Fedora 1.0 : docker build -t fedora/jboss:1.0 . "whenry" Fedora JBoss 2.1 : docker build -t whenry/fedora-jboss:v2.1 . latest : docker build -t whenry/fedora-jboss . latest . . latest . whenry/fedora- jboss:latest whenry/fedora-jboss:v2.1 : docker build -t whenry/fedora-jboss:latest -t whenry/fedora-jboss:v2.1 . Docker . (Building an image using a URL) GitHub URL . Dockerfile Dockerfile . GitHub . docker build github.com/scollier/purpletest : Git git:// . tar (Building an image using a URL to a tarball'ed context) URL Docker . tarball . Dockerfile . -f PATH/Dockerfile tarball . docker build -f dev/Dockerfile https://10.10.10.1/docker/context.tar.gz : 'xz' 'bzip2' 'gzip' 'identity' ( ). (--isolation) (Specify isolation technology for container (--isolation)) Docker . --isolation . default namespace . : o default: --exec-opt Docker. daemon process . o process: (Namespace). o hyperv: Hyper-V. (HISTORY) William Henry (whenry at redhat dot com) docker.com . Sven Dowideit SvenDowideit@home.org.au Sally O'Malley somalley@redhat.com Des Preston despreston@gmail.com Docker Community JUNE 2014 DOCKER(1)