3 %bcond_with tests # build without tests
4 %bcond_with vim # build vim syntax package (bundled in vim 7.4.979-2)
5 %bcond_with doc # build manual pages
8 # https://github.com/docker/docker/blob/master/project/PACKAGERS.md#build-dependencies
10 # v1.0.0-rc2-123-gac031b5
11 %define runc_commit ac031b5
13 %define containerd_commit 8517738
14 # v0.8.0-dev.2-464-g0f53435
15 %define libnetwork_commit 0f53435
17 Summary: Docker: the open-source application container engine
22 Group: Applications/System
23 # https://github.com/docker/docker/releases
24 Source0: https://github.com/docker/docker/archive/v%{version}%{subver}/%{name}-%{version}%{subver}.tar.gz
25 # Source0-md5: 3e40a95c40182314a5c2ba41f5b7d7d2
26 Source1: https://github.com/docker/runc/archive/%{runc_commit}/runc-%{runc_commit}.tar.gz
27 # Source1-md5: 5c22c984bb610dbcd57d11c83125f376
28 Source2: https://github.com/docker/containerd/archive/%{containerd_commit}/containerd-%{containerd_commit}.tar.gz
29 # Source2-md5: f5f0654554164fe3e3433e41955b64f9
30 Source3: https://github.com/docker/libnetwork/archive/%{libnetwork_commit}/libnetwork-%{libnetwork_commit}.tar.gz
31 # Source3-md5: 7cfbfe76355aae3577c77a6a4b2c92db
34 Source8: %{name}.sysconfig
36 URL: http://www.docker.com/
37 BuildRequires: btrfs-progs-devel >= 3.16.1
38 BuildRequires: device-mapper-devel >= 2.02.89
39 BuildRequires: golang >= 1.6
40 BuildRequires: libseccomp-devel >= 2.2.1
41 BuildRequires: rpmbuild(macros) >= 1.644
42 BuildRequires: sqlite3-devel >= 3.7.9
43 Requires(post,preun): /sbin/chkconfig
44 Requires(postun): /usr/sbin/groupdel
45 Requires(pre): /usr/bin/getgid
46 Requires(pre): /usr/sbin/groupadd
47 Requires: ca-certificates
48 Requires: iproute2 >= 3.5
50 Requires: rc-scripts >= 0.4.0.10
51 Requires: systemd-units >= 38
52 Requires: tar >= 1:1.26
53 Requires: uname(release) >= 3.8
55 Suggests: docker-credential-helpers
56 Suggests: git-core >= 1.7
59 Provides: group(docker)
60 Obsoletes: lxc-docker < 1.1.1
61 # only runs on x64 hosts for now:
62 # https://github.com/docker/docker/issues/136
63 # https://github.com/docker/docker/issues/611
64 ExclusiveArch: %{x8664}
65 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
67 %define bash_compdir %{_datadir}/bash-completion/completions
68 %define zsh_compdir %{_datadir}/zsh/site-functions
69 %define _vimdatadir %{_datadir}/vim
70 %define _libexecdir %{_prefix}/lib
72 # binary stripped or something
73 %define _enable_debug_packages 0
76 Docker is an open source project to pack, ship and run any application
77 as a lightweight container
79 Docker containers are both hardware-agnostic and platform-agnostic.
80 This means that they can run anywhere, from your laptop to the largest
81 EC2 compute instance and everything in between - and they don't
82 require that you use a particular language, framework or packaging
83 system. That makes them great building blocks for deploying and
84 scaling web apps, databases and backend services without depending on
85 a particular stack or provider.
87 Docker is an open-source implementation of the deployment engine which
88 powers dotCloud, a popular Platform-as-a-Service. It benefits directly
89 from the experience accumulated over several years of large-scale
90 operation and support of hundreds of thousands of applications and
93 %package -n bash-completion-%{name}
94 Summary: bash-completion for Docker
95 Summary(pl.UTF-8): bashowe uzupełnianie nazw dla Dockera
96 Group: Applications/Shells
98 Requires: bash-completion >= 2.0
99 Obsoletes: bash-completion-lxc-docker < 1.1.1
100 %if "%{_rpmversion}" >= "5"
104 %description -n bash-completion-%{name}
105 This package provides bash-completion for Docker.
107 %description -n bash-completion-%{name} -l pl.UTF-8
108 Pakiet ten dostarcza bashowe uzupełnianie nazw dla Dockera.
110 %package -n zsh-completion-%{name}
111 Summary: zsh completion for Docker
112 Summary(pl.UTF-8): Uzupełnianie parametrów w zsh dla poleceń Dockera
113 Group: Applications/Shells
115 %if "%{_rpmversion}" >= "5"
119 %description -n zsh-completion-%{name}
120 This package provides zsh completion for Docker.
122 %description -n zsh-completion-%{name} -l pl.UTF-8
123 Pakiet ten dostarcza uzupełnianie w zsh dla poleceń Dockera.
125 %package -n vim-syntax-%{name}
126 Summary: Vim syntax: Docker
127 Group: Applications/Editors/Vim
128 Requires: %{name} = %{version}-%{release}
129 Requires: vim-rt >= 4:7.2.170
130 Obsoletes: vim-syntax-lxc-docker < 1.1.1
131 %if "%{_rpmversion}" >= "5"
135 %description -n vim-syntax-%{name}
136 This plugin provides syntax highlighting in Dockerfile.
139 %setup -q %{?subver:-n %{name}-%{version}%{subver}} -a1 -a2 -a3
140 mv runc-%{runc_commit}* runc
141 mv containerd-%{containerd_commit}* containerd
142 mv libnetwork-%{libnetwork_commit}* libnetwork
145 install -d vendor/src/github.com/docker
146 ln -s $(pwd) vendor/src/github.com/docker/docker
147 ln -s $(pwd)/containerd containerd/vendor/src/github.com/docker/containerd
148 ln -s $(pwd)/libnetwork vendor/src/github.com/docker/libnetwork
151 v=$(awk -F= '/RUNC_COMMIT/ {print $2}' hack/dockerfile/binaries-commits)
152 echo "$v" | grep "^%{runc_commit}"
153 v=$(awk -F= '/CONTAINERD_COMMIT/ {print $2}' hack/dockerfile/binaries-commits)
154 echo "$v" | grep "^%{containerd_commit}"
155 v=$(awk -F= '/LIBNETWORK_COMMIT/ {print $2}' hack/dockerfile/binaries-commits)
156 echo "$v" | grep "^%{libnetwork_commit}"
158 export GOPATH=$(pwd)/vendor:$(pwd)/containerd/vendor
159 export DOCKER_GITCOMMIT="pld/%{version}"
163 # build docker-containerd
164 %{__make} -C containerd
167 go build -ldflags="$PROXY_LDFLAGS" \
169 github.com/docker/libnetwork/cmd/proxy
171 bash -x hack/make.sh dynbinary
177 rm -rf $RPM_BUILD_ROOT
178 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_mandir}/man1,/etc/{rc.d/init.d,sysconfig},%{systemdunitdir}} \
179 $RPM_BUILD_ROOT%{_libexecdir} \
180 $RPM_BUILD_ROOT/var/lib/docker/{containers,execdriver,graph,image,init,network,swarm,tmp,trust,vfs,volumes}
182 install -p bundles/%{version}%{?subver}/dynbinary-client/docker-%{version}%{?subver} $RPM_BUILD_ROOT%{_bindir}/docker
183 install -p bundles/%{version}%{?subver}/dynbinary-daemon/dockerd-%{version}%{?subver} $RPM_BUILD_ROOT%{_sbindir}/dockerd
185 # install docker-runc
186 install -p runc/runc $RPM_BUILD_ROOT%{_sbindir}/docker-runc
188 # install docker-containerd
189 install -p containerd/bin/containerd $RPM_BUILD_ROOT%{_sbindir}/docker-containerd
190 install -p containerd/bin/containerd-shim $RPM_BUILD_ROOT%{_sbindir}/docker-containerd-shim
191 install -p containerd/bin/ctr $RPM_BUILD_ROOT%{_sbindir}/docker-containerd-ctr
193 # install docker-proxy
194 install -p docker-proxy $RPM_BUILD_ROOT%{_sbindir}/docker-proxy
196 cp -p contrib/init/systemd/docker.service $RPM_BUILD_ROOT%{systemdunitdir}
197 cp -p contrib/init/systemd/docker.socket $RPM_BUILD_ROOT%{systemdunitdir}
198 install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/docker
199 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/dockerd
200 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/sysconfig/docker
203 install -d $RPM_BUILD_ROOT/lib/udev/rules.d
204 cp -p contrib/udev/80-docker.rules $RPM_BUILD_ROOT/lib/udev/rules.d
206 # bash and zsh completion
207 install -d $RPM_BUILD_ROOT%{bash_compdir}
208 cp -p contrib/completion/bash/docker $RPM_BUILD_ROOT%{bash_compdir}/docker
209 install -d $RPM_BUILD_ROOT%{zsh_compdir}
210 cp -p contrib/completion/zsh/_docker $RPM_BUILD_ROOT%{zsh_compdir}
214 install -d $RPM_BUILD_ROOT%{_vimdatadir}
215 cp -a contrib/syntax/vim/* $RPM_BUILD_ROOT%{_vimdatadir}
216 %{__rm} $RPM_BUILD_ROOT%{_vimdatadir}/{LICENSE,README.md}
220 %groupadd -g 296 docker
223 /sbin/chkconfig --add %{name}
224 %service -n %{name} restart
225 %systemd_post %{name}.service
228 if [ "$1" = "0" ]; then
229 %service -q %{name} stop
230 /sbin/chkconfig --del %{name}
232 %systemd_preun %{name}.service
235 if [ "$1" = "0" ]; then
241 rm -rf $RPM_BUILD_ROOT
244 %defattr(644,root,root,755)
245 %doc README.md CHANGELOG.md CONTRIBUTING.md LICENSE AUTHORS NOTICE MAINTAINERS
246 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/docker
247 %attr(754,root,root) /etc/rc.d/init.d/docker
248 %attr(755,root,root) %{_bindir}/docker
249 %attr(755,root,root) %{_sbindir}/docker-containerd
250 %attr(755,root,root) %{_sbindir}/docker-containerd-ctr
251 %attr(755,root,root) %{_sbindir}/docker-containerd-shim
252 %attr(755,root,root) %{_sbindir}/docker-proxy
253 %attr(755,root,root) %{_sbindir}/docker-runc
254 %attr(755,root,root) %{_sbindir}/dockerd
255 %attr(755,root,root) %{_libexecdir}/dockerd
256 %{systemdunitdir}/docker.service
257 %{systemdunitdir}/docker.socket
258 /lib/udev/rules.d/80-docker.rules
260 %dir %attr(700,root,root) /var/lib/docker
261 %dir %attr(700,root,root) /var/lib/docker/containers
262 %dir %attr(700,root,root) /var/lib/docker/execdriver
263 %dir %attr(700,root,root) /var/lib/docker/graph
264 %dir %attr(700,root,root) /var/lib/docker/image
265 %dir %attr(700,root,root) /var/lib/docker/init
266 %dir %attr(700,root,root) /var/lib/docker/network
267 %dir %attr(700,root,root) /var/lib/docker/swarm
268 %dir %attr(700,root,root) /var/lib/docker/tmp
269 %dir %attr(700,root,root) /var/lib/docker/trust
270 %dir %attr(700,root,root) /var/lib/docker/vfs
271 %dir %attr(700,root,root) /var/lib/docker/volumes
273 %files -n bash-completion-%{name}
274 %defattr(644,root,root,755)
275 %{bash_compdir}/docker
277 %files -n zsh-completion-%{name}
278 %defattr(644,root,root,755)
279 %{zsh_compdir}/_docker
282 %files -n vim-syntax-%{name}
283 %defattr(644,root,root,755)
284 %doc contrib/syntax/vim/{README.md,LICENSE}
285 %{_vimdatadir}/doc/dockerfile.txt
286 %{_vimdatadir}/ftdetect/dockerfile.vim
287 %{_vimdatadir}/syntax/dockerfile.vim