]> git.pld-linux.org Git - packages/docker-ce.git/blob - docker-ce.spec
up to 18.09.2 (with runc patched against CVE-2019-5736)
[packages/docker-ce.git] / docker-ce.spec
1 #
2 # Conditional build:
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
6
7 # TODO: drop P docker when docker-compose updated to use docker(engine) dep
8
9 # NOTES
10 # - https://github.com/docker/docker-ce/releases
11 # - https://github.com/moby/moby/blob/master/project/PACKAGERS.md#build-dependencies
12
13 # v1.0.0-rc6
14 %define runc_commit 96ec217
15 # v1.2.2
16 %define containerd_commit 9754871
17 # v0.8.0-dev.2-1075-g1b91bc94
18 %define libnetwork_commit 2cfbf9b
19 #define subver -rc2
20 Summary:        Docker CE: the open-source application container engine
21 Name:           docker-ce
22 # Using Docker-CE, Stay on Stable channel
23 # https://docs.docker.com/engine/installation/
24 Version:        18.09.2
25 Release:        1
26 License:        Apache v2.0
27 Group:          Applications/System
28 # https://github.com/docker/docker-ce/releases
29 #Source0:       https://github.com/docker/docker-ce/archive/v%{version}-ce%{subver}/%{name}-%{version}-ce%{subver}.tar.gz
30 Source0:        https://github.com/docker/docker-ce/archive/v%{version}/%{name}-%{version}.tar.gz
31 # Source0-md5:  8a67b2ebca0d3dbc0a268183b0990bd5
32 Source1:        https://github.com/opencontainers/runc/archive/%{runc_commit}/runc-%{runc_commit}.tar.gz
33 # Source1-md5:  61f1deb4105cbca21d7acde965fb56c0
34 Source2:        https://github.com/containerd/containerd/archive/%{containerd_commit}/containerd-%{containerd_commit}.tar.gz
35 # Source2-md5:  129971a64170033244a880ebb04e1244
36 Source3:        https://github.com/docker/libnetwork/archive/%{libnetwork_commit}/libnetwork-%{libnetwork_commit}.tar.gz
37 # Source3-md5:  d09e629940b04e24a2f91b535c073f83
38 Source4:        https://github.com/krallin/tini/archive/v0.18.0/tini-0.18.0.tar.gz
39 # Source4-md5:  cc3b205a1b83b8e6ed6892fc5e8ef2c3
40 Source5:        dockerd.sh
41 Source7:        docker.init
42 Source8:        docker.sysconfig
43 Patch0:         systemd.patch
44 Patch1:         cve-2019-5736.patch
45 URL:            https://www.docker.com/community-edition/
46 BuildRequires:  btrfs-progs-devel >= 3.16.1
47 BuildRequires:  cmake
48 BuildRequires:  device-mapper-devel >= 2.02.89
49 BuildRequires:  golang >= 1.10
50 BuildRequires:  libseccomp-devel >= 2.3
51 BuildRequires:  rpmbuild(macros) >= 1.644
52 BuildRequires:  sqlite3-devel >= 3.7.9
53 BuildRequires:  xxd
54 Requires(post,preun):   /sbin/chkconfig
55 Requires(postun):       /usr/sbin/groupdel
56 Requires(pre):  /usr/bin/getgid
57 Requires(pre):  /usr/sbin/groupadd
58 Requires:       ca-certificates
59 Requires:       iproute2 >= 3.5
60 Requires:       iptables
61 Requires:       rc-scripts >= 0.4.0.10
62 Requires:       systemd-units >= 38
63 Requires:       tar >= 1:1.26
64 Requires:       uname(release) >= 3.8
65 Requires:       xz
66 Suggests:       docker-credential-helpers
67 Suggests:       git-core >= 1.7
68 Suggests:       libcgroup
69 Suggests:       xz >= 1:4.9
70 Provides:       docker = %{version}
71 Provides:       docker(engine) = %{version}
72 Provides:       group(docker)
73 Requires:       libseccomp >= 2.3
74 Obsoletes:      docker < 18.0
75 Obsoletes:      lxc-docker < 1.1.1
76 # only runs on x64 hosts for now:
77 # https://github.com/docker/docker/issues/136
78 # https://github.com/docker/docker/issues/611
79 ExclusiveArch:  %{x8664}
80 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
81
82 %define         bash_compdir    %{_datadir}/bash-completion/completions
83 %define         zsh_compdir     %{_datadir}/zsh/site-functions
84 %define         _vimdatadir             %{_datadir}/vim
85 %define         _libexecdir             %{_prefix}/lib
86
87 # binary stripped or something
88 %define         _enable_debug_packages 0
89
90 %description
91 Docker is an open source project to pack, ship and run any application
92 as a lightweight container
93
94 Docker containers are both hardware-agnostic and platform-agnostic.
95 This means that they can run anywhere, from your laptop to the largest
96 EC2 compute instance and everything in between - and they don't
97 require that you use a particular language, framework or packaging
98 system. That makes them great building blocks for deploying and
99 scaling web apps, databases and backend services without depending on
100 a particular stack or provider.
101
102 Docker is an open-source implementation of the deployment engine which
103 powers dotCloud, a popular Platform-as-a-Service. It benefits directly
104 from the experience accumulated over several years of large-scale
105 operation and support of hundreds of thousands of applications and
106 databases.
107
108 %package -n bash-completion-%{name}
109 Summary:        bash-completion for Docker
110 Summary(pl.UTF-8):      bashowe uzupełnianie nazw dla Dockera
111 Group:          Applications/Shells
112 Requires:       %{name}
113 Requires:       bash-completion >= 2.0
114 Obsoletes:      bash-completion-lxc-docker < 1.1.1
115 %if "%{_rpmversion}" >= "5"
116 BuildArch:      noarch
117 %endif
118
119 %description -n bash-completion-%{name}
120 This package provides bash-completion for Docker.
121
122 %description -n bash-completion-%{name} -l pl.UTF-8
123 Pakiet ten dostarcza bashowe uzupełnianie nazw dla Dockera.
124
125 %package -n zsh-completion-%{name}
126 Summary:        zsh completion for Docker
127 Summary(pl.UTF-8):      Uzupełnianie parametrów w zsh dla poleceń Dockera
128 Group:          Applications/Shells
129 Requires:       %{name}
130 %if "%{_rpmversion}" >= "5"
131 BuildArch:      noarch
132 %endif
133
134 %description -n zsh-completion-%{name}
135 This package provides zsh completion for Docker.
136
137 %description -n zsh-completion-%{name} -l pl.UTF-8
138 Pakiet ten dostarcza uzupełnianie w zsh dla poleceń Dockera.
139
140 %package -n vim-syntax-%{name}
141 Summary:        Vim syntax: Docker
142 Group:          Applications/Editors/Vim
143 Requires:       %{name} = %{version}-%{release}
144 Requires:       vim-rt >= 4:7.2.170
145 Obsoletes:      vim-syntax-lxc-docker < 1.1.1
146 %if "%{_rpmversion}" >= "5"
147 BuildArch:      noarch
148 %endif
149
150 %description -n vim-syntax-%{name}
151 This plugin provides syntax highlighting in Dockerfile.
152
153 %prep
154 %setup -q -n %{name}-%{version}%{?subver} -a1 -a2 -a3 -a4
155
156 mv runc-%{runc_commit}* runc
157 mv runc/vendor runc/src
158 ln -s ../../.. runc/src/github.com/opencontainers/runc
159
160 mv containerd-%{containerd_commit}* containerd
161 mv containerd/vendor containerd/src
162 ln -s ../../.. containerd/src/github.com/containerd/containerd
163
164 mv libnetwork-%{libnetwork_commit}* libnetwork
165 install -d libnetwork/gopath
166 mv libnetwork/vendor libnetwork/gopath/src
167 ln -s ../../../.. libnetwork/gopath/src/github.com/docker/libnetwork
168
169 mv tini-* tini
170
171 install -d components/cli/.gopath/src/github.com/docker
172 ln -s ../../../.. components/cli/.gopath/src/github.com/docker/cli
173
174 %patch0 -p1 -d components/engine
175 %patch1 -p1 -d runc
176
177 %build
178 grep -rhE "=%{runc_commit}|=%{containerd_commit}|=%{libnetwork_commit}" $(pwd)/components/engine/hack/dockerfile/install/
179
180 export VERSION=%{version}-ce # for `docker version`
181 export GITCOMMIT="PLD-Linux/%{version}" # for cli
182 export DOCKER_GITCOMMIT="PLD-Linux/%{version}" # for engine
183
184 # build runc
185 sed -i -e 's,shell git,shell false,' runc/Makefile
186 GOPATH=$(pwd)/runc \
187 %{__make} -C runc \
188         COMMIT=$RUNC_COMMIT
189 ./runc/runc -v
190
191 # build containerd
192 GOPATH=$(pwd)/containerd \
193 %{__make} -C containerd \
194         GIT_COMMIT=$CONTAINERD_COMMIT
195
196 # build docker-proxy
197 cd libnetwork
198 GOPATH=$(pwd)/gopath \
199 go build -ldflags="-linkmode=external" \
200         -o docker-proxy \
201         github.com/docker/libnetwork/cmd/proxy
202 cd ..
203
204 # build docker-init
205 cd tini
206 cmake .
207 %{__make}
208
209 # docker cli
210 cd ../components/cli
211 GOPATH=$(pwd)/.gopath \
212 DISABLE_WARN_OUTSIDE_CONTAINER=1 \
213 %{__make} dynbinary
214 ./build/docker -v
215
216 cd ../engine
217 AUTO_GOPATH=1 \
218 bash -x hack/make.sh dynbinary
219 ./bundles/latest/dynbinary-daemon/dockerd -v
220 %if %{with doc}
221 man/md2man-all.sh
222 %endif
223
224 %install
225 rm -rf $RPM_BUILD_ROOT
226 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_mandir}/man1,/etc/{rc.d/init.d,sysconfig},%{systemdunitdir}} \
227         $RPM_BUILD_ROOT%{_libexecdir} \
228         $RPM_BUILD_ROOT/var/lib/docker/{containers,execdriver,graph,image,init,network,swarm,tmp,trust,vfs,volumes}
229
230 # docker-cli
231 install -p components/cli/build/docker $RPM_BUILD_ROOT%{_bindir}/docker
232
233 # runc
234 install -p runc/runc $RPM_BUILD_ROOT%{_sbindir}/runc
235
236 # containerd
237 install -p containerd/bin/containerd $RPM_BUILD_ROOT%{_sbindir}/containerd
238 install -p containerd/bin/containerd-shim $RPM_BUILD_ROOT%{_sbindir}/containerd-shim
239 install -p containerd/bin/ctr $RPM_BUILD_ROOT%{_sbindir}/ctr
240
241 # docker-proxy
242 install -p libnetwork/docker-proxy $RPM_BUILD_ROOT%{_sbindir}/docker-proxy
243
244 # docker-init
245 install -p tini/tini $RPM_BUILD_ROOT%{_sbindir}/docker-init
246
247 # dockerd
248 cd components/engine
249 install -p bundles/latest/dynbinary-daemon/dockerd $RPM_BUILD_ROOT%{_sbindir}/dockerd
250 cp -p contrib/init/systemd/docker.service $RPM_BUILD_ROOT%{systemdunitdir}
251 cp -p contrib/init/systemd/docker.socket $RPM_BUILD_ROOT%{systemdunitdir}
252 install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/docker
253 install -p %{SOURCE5} $RPM_BUILD_ROOT%{_libexecdir}/dockerd
254 cp -p %{SOURCE8} $RPM_BUILD_ROOT/etc/sysconfig/docker
255
256 # install udev rules
257 install -d $RPM_BUILD_ROOT/lib/udev/rules.d
258 cp -p contrib/udev/80-docker.rules $RPM_BUILD_ROOT/lib/udev/rules.d
259
260 # vim syntax
261 %if %{with vim}
262 install -d $RPM_BUILD_ROOT%{_vimdatadir}
263 cp -a contrib/syntax/vim/* $RPM_BUILD_ROOT%{_vimdatadir}
264 %{__rm} $RPM_BUILD_ROOT%{_vimdatadir}/{LICENSE,README.md}
265 %endif
266
267 # bash and zsh completion
268 cd ../cli/contrib/completion
269 install -d $RPM_BUILD_ROOT%{bash_compdir}
270 cp -p bash/docker $RPM_BUILD_ROOT%{bash_compdir}
271 install -d $RPM_BUILD_ROOT%{zsh_compdir}
272 cp -p zsh/_docker $RPM_BUILD_ROOT%{zsh_compdir}
273
274 %pre
275 %groupadd -g 296 docker
276
277 %post
278 /sbin/chkconfig --add docker
279 %service -n docker restart
280 %systemd_post docker.service
281
282 %preun
283 if [ "$1" = "0" ]; then
284         %service -q docker stop
285         /sbin/chkconfig --del docker
286 fi
287 %systemd_preun docker.service
288
289 %postun
290 if [ "$1" = "0" ]; then
291         %groupremove docker
292 fi
293 %systemd_reload
294
295 %triggerun -- docker < 17.0
296 # Prevent preun from docker from working
297 chmod a-x /etc/rc.d/init.d/docker
298
299 %triggerpostun -- docker < 17.0
300 # Restore what triggerun removed
301 chmod 754 /etc/rc.d/init.d/docker
302 # reinstall docker init.d links, which could be different
303 /sbin/chkconfig --del docker
304 /sbin/chkconfig --add docker
305
306 %clean
307 rm -rf $RPM_BUILD_ROOT
308
309 %files
310 %defattr(644,root,root,755)
311 %doc components/engine/{README.md,CHANGELOG.md,CONTRIBUTING.md,LICENSE,AUTHORS,NOTICE,MAINTAINERS}
312 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/docker
313 %attr(754,root,root) /etc/rc.d/init.d/docker
314 %attr(755,root,root) %{_bindir}/docker
315 %attr(755,root,root) %{_sbindir}/containerd
316 %attr(755,root,root) %{_sbindir}/ctr
317 %attr(755,root,root) %{_sbindir}/containerd-shim
318 %attr(755,root,root) %{_sbindir}/docker-init
319 %attr(755,root,root) %{_sbindir}/docker-proxy
320 %attr(755,root,root) %{_sbindir}/runc
321 %attr(755,root,root) %{_sbindir}/dockerd
322 %attr(755,root,root) %{_libexecdir}/dockerd
323 %{systemdunitdir}/docker.service
324 %{systemdunitdir}/docker.socket
325 /lib/udev/rules.d/80-docker.rules
326
327 %dir %attr(700,root,root) /var/lib/docker
328 %dir %attr(700,root,root) /var/lib/docker/containers
329 %dir %attr(700,root,root) /var/lib/docker/execdriver
330 %dir %attr(700,root,root) /var/lib/docker/graph
331 %dir %attr(700,root,root) /var/lib/docker/image
332 %dir %attr(700,root,root) /var/lib/docker/init
333 %dir %attr(700,root,root) /var/lib/docker/network
334 %dir %attr(700,root,root) /var/lib/docker/swarm
335 %dir %attr(700,root,root) /var/lib/docker/tmp
336 %dir %attr(700,root,root) /var/lib/docker/trust
337 %dir %attr(700,root,root) /var/lib/docker/vfs
338 %dir %attr(700,root,root) /var/lib/docker/volumes
339
340 %files -n bash-completion-%{name}
341 %defattr(644,root,root,755)
342 %{bash_compdir}/docker
343
344 %files -n zsh-completion-%{name}
345 %defattr(644,root,root,755)
346 %{zsh_compdir}/_docker
347
348 %if %{with vim}
349 %files -n vim-syntax-%{name}
350 %defattr(644,root,root,755)
351 %doc components/engine/contrib/syntax/vim/{README.md,LICENSE}
352 %{_vimdatadir}/doc/dockerfile.txt
353 %{_vimdatadir}/ftdetect/dockerfile.vim
354 %{_vimdatadir}/syntax/dockerfile.vim
355 %endif
This page took 0.104403 seconds and 4 git commands to generate.