Files
scylladb/dist/docker/redhat
Avi Kivity e96ff3d82d dist: add new docker building process
The new process has the following differences from the Dockerfile
based image:

 - Using buildah commands instead of a Dockerfile. This is more flexible
   since we don't need to pack everything into a "build context" and
   transfer it to the container; instead we interact with the container
   as we build it.
 - Using packages instead of a remote yum repository. This makes it
   easy to create an image in one step (no need to create a repository,
   promote, then download the packages back via yum. It means that
   the image cannot be upgraded via yum, but container images are
   usually just replaced with a new version.
 - Build output is an OCI archive (e.g. a tarball), not a docker image
   in a local repoistory. This means the build process can later be
   integrated into ninja, since the artifact is just a file. The file
   can be uploaded into a repository or made available locally with
   skopeo.
 - any build mode is supported, not just release. This can be used
   for quick(er) testing with dev mode.

I plan to integrate it further into the build system, but currently
this is blocked on a buildah bug [1].

[1] https://github.com/containers/buildah/issues/3262

Closes #8730
2021-05-31 10:05:22 +03:00
..
2021-04-01 20:40:52 +03:00

Building a CentOS-based Docker image

Running

docker build -t <image-name> .

in this directory will build a Docker image of Scylla. You can then run it with, for example,

docker run --name scylla -d -p 9042:9042 -t <image name>

However, it is important to note that while the resulting image will contain some scripts taken from this directory, the actual Scylla executable will not be taken from this build directory. Instead, our Dockerfile downloads the Scylla executable and other Scylla tools (e.g., JMX, nodetool, etc.) from http://downloads.scylladb.com/. If you want to build a Docker image which includes a Scylla executable which you compiled yourself, please refer to the next section.

Docker image with a self-built executable

The following instructions will allow you to build a Docker image which contains a combination of some tools from the nightly build in http://downloads.scylladb.com/ (as described above) but with a Scylla executable which you build yourself.

The following instructions are currently messy, but we hope to one day make them as simple as "ninja docker".

Do the following in the top-level Scylla source directory:

  1. Build your own Scylla in whatever build mode you prefer, e.g., dev.

  2. Run ninja dist-rpm

  3. cd to dist/docker/redhat

  4. Docker stubbornly refuses to allow using files from outside the current directory in preparing images, so we must copy the RPMs prepared above into the current directory (a symbolic link would not work): rm -r rpms; cp -a ../../../build/dist/dev/redhat/RPMS/x86_64/ rpms

  5. Add the following lines near the end of Dockerfile, after the RUN curl:

    COPY rpms /rpms
    RUN yum install -y /rpms/*.rpm
    
  6. Finally, run docker build -t <image-name> .