Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update custom image doc with NO_KEY #10

Merged
merged 3 commits into from
Apr 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 31 additions & 12 deletions content/containers/creating-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,19 @@ ARG BUILDER_OS_VERSION="7.9.2009"
```
Both versions that you select must correspond to a docker tag for the OS images.

When the MINIMAL argument is set to YES, the Dockerfile builds a smaller image. The smaller image omits large packages like Tensorflow and the Java runtime, which is required only to run Java UDx's. This will result in over 300MB (uncompressed) of savings. By default, we build the full image.
When the `MINIMAL` argument is set to `YES`, the Dockerfile builds a smaller image. The smaller image omits large packages like Tensorflow and the Java runtime, which is required only to run Java UDx's. This will result in over 300MB (uncompressed) of savings. By default, we build the full image.

```
ARG MINIMAL=""
```

We use [s6](https://github.com/just-containers/s6-overlay) as the init program. This argument allows you to choose the version of that program. This version refers to one of the GitHub releases on the [s6 GitHub repository](https://github.com/just-containers/s6-overlay).
The `NO_KEYS` argument is optional. In some circumstances, you might want to manage the SSH keys that authenticate connections to the Vertica server container. When you set this argument to `YES`, the Dockerfile requires user-provided SSH keys:

```
ARG NO_KEYS=""
```

We use [s6](https://github.com/just-containers/s6-overlay) as the init program. This argument allows you to choose the version of that program. This version refers to one of the GitHub releases on the s6 [GitHub repository](https://github.com/just-containers/s6-overlay).
```
ARG S6_OVERLAY_VERSION=3.1.2.1
```
Expand All @@ -76,10 +82,11 @@ Container files use the `ARG` instruction to define build process variables. **V
ARG VERTICA_RPM="vertica-x86_64.RHEL6.latest.rpm"
```

The MINIMAL argument is already globally defined--the following line makes the variable available in this stage:
The `MINIMAL` and `NO_KEYS` arguments are already globally defined--the following lines makes them available in this stage:

```
ARG MINIMAL
ARG NO_KEYS
```

The next two variables define the default UID and GID of the [dbadmin](https://www.vertica.com/docs/latest/HTML/Content/Authoring/AdministratorsGuide/DBUsersAndPrivileges/Roles/DBADMINRole.htm) user account in the container:
Expand Down Expand Up @@ -122,6 +129,14 @@ This section incrementally builds a single `RUN` instruction. The `RUN` instruct

Each `RUN` instruction adds a layer to the final image. To limit the number of `RUN` instructions, use the Bash **&&** operator to chain multiple `RUN` commands into a single command. To chain commands that span multiple lines into a single command, enter the backslash ( **\\** ) character at the end of the line.

#### Set up the shell

The following command ensures that the build fails if any of the subsequent `RUN` commands fail:

```
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
```

#### Begin the RUN Instruction

Add `RUN set -x` to log each command to the console as it is executed:
Expand Down Expand Up @@ -243,19 +258,22 @@ The following commands copy the static SSH key to use for root and ensures all k

```
  && mkdir -p /root/.ssh \
  && cp -r /home/dbadmin/.ssh /root \
  && chmod 700 /root/.ssh \
  && chmod 600 /root/.ssh/* \
  && mkdir -p /home/dbadmin/.ssh \
  && chmod 600 /home/dbadmin/.ssh/* \
&& if [[ ${NO_KEYS^^} != "YES" ]] ; then \
cp -r /home/dbadmin/.ssh /root; \
chmod 700 /root/.ssh; \
chmod 600 /root/.ssh/*; \
fi \
```
#### Ensure proper ownership and permissions

Ensure that everything under /home/dbadmin has the correct ownership and the ssh config files have the correct permissions:

```
  && chown -R dbadmin:verticadba /home/dbadmin/ \
&& chmod go-w /etc/ssh/sshd_config.d/* /etc/ssh/ssh_config.d/*
&& chmod go-w /etc/ssh/sshd_config.d/* /etc/ssh/ssh_config.d/* \
&& if [[ ${NO_KEYS^^} == "YES" ]] ; then \
rm -rf /home/dbadmin/.ssh/*; \
fi
```

## Second Stage
Expand Down Expand Up @@ -418,7 +436,7 @@ Vertica and [Admintools](https://www.vertica.com/docs/latest/HTML/Content/Author
Add the following only if you are building a minimal image:

```
&& if ($MINIMAL != "YES" && $MINIMAL != "yes") ; then \
&& if [[ ${MINIMAL^^} != "YES" ]] ; then \
apt-get install -y --no-install-recommends $JRE_PKG; \
fi \
```
Expand Down Expand Up @@ -494,11 +512,12 @@ This step changes cron so that it's setuid. This is done so that s6 doesn't t ha

#### Unpack s6

We copied s6 tar files in an earlier step. This extracts them into the root of the file system:
We copied s6 tar files in an earlier step. This will extract them into the root of the file system and delete the old host SSH keys:

```
&& tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz \
&& tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
&& tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz \
&& rm -rf /etc/ssh/ssh_host*
```

## The Entrypoint Script
Expand Down