はじめに
Red Hat からリリースされているOpenShift4
そろそろ試してみようかなと思いチャレンジしてみます!
(うまくいってません(笑))
環境
- Docker for Windows
- Ubuntu:lastest on docker
Prerequisites
OSに関する要求事項。ハードルがかなり上がってます(笑)
dockerでできるのかなぁ!?
CodeReady Containers requires the following system resources in order to run OpenShift:
- 4 virtual CPUs (vCPUs)
- 8 GB of memory
- 35 GB of storage space
ちなみにdockerにしているのは、うちのNotePCをWindows10 HomeからWindows10 Proにアップグレードし、Hyper-V入れてDocker for Windowsを入れたら、Hyper-VもVMwareもVirtualBoxも動作しなくなっちゃったため
原因が良く分からないけど、HyperVisorが複数入っているのが原因っぽい
Dockerfile
こんな感じでまとめました。
RUNを細切れにしているのはcacheを効かせるためです(笑)
ちなみに『Getting started with Red Hat CodeReady Containers』に記載のものとは以下を変えています。
1.2. Installing CodeReady Containers
マニュアル上ではlibvirtd
groupになっているけどもそんなグループはないlibvirt
groupに変更
- On Debian or Ubuntu, perform the following steps:
a. Add your user to the libvirtd group:
$ sudo usermod -aG libvirtd $(whoami)
> b. Update your current session to apply the group change:
> ```console
$ newgrp libvirtd
FROM ubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive \
USER_ID=minishift \
GROUP_ID=libvirt
RUN ln -sf /usr/share/zoneinfo/Japan /etc/localtime
RUN apt-get -y update
RUN apt -y install curl qemu-kvm libvirt-daemon libvirt-daemon-system network-manager
RUN apt-get -y autoremove && \
apt-get -y clean
RUN service network-manager start
ARG DOCKER_UID=1001
ARG DOCKER_USER=minishift
ARG DOCKER_PASSWORD=minishift
RUN useradd -m \
--uid ${DOCKER_UID} --groups sudo --shell /bin/bash ${DOCKER_USER} \
&& echo ${DOCKER_USER}:${DOCKER_PASSWORD} | chpasswd
RUN usermod -aG ${GROUP_ID} ${DOCKER_USER}
RUN curl -sS https://mirror.openshift.com/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz -o /tmp/crc-linux-amd64.tar.xz
RUN xz -dc /tmp/crc-linux-amd64.tar.xz | tar xfv - && \
mv crc-linux-*/crc /usr/local/bin/crc
USER ${DOCKER_USER}
RUN newgrp ${GROUP_ID} && \
crc config set skip-check-user-in-libvirt-group true
WORKDIR /home/${DOCKER_USER}
EXPOSE 443
RUN crc setup --help
RUN crc setup
CMD [ "crc", "start" ]
version: '3.7'
services:
minishift:
container_name: minishift
build: ./
image: minishift:4.1
restart: always
docker-compose build
Buildしてみるとエラーが発生(汗
NetworkManager is required. Please make sure it is installed and running manually
いやインストールしているのはubuntu
なんですけど…
NetworkManager
じゃなくってnetwork-manager
では!? Red Hatさん
C:\Git\minishift4>docker-compose build
:
Step 20/22 : RUN crc setup --help
---> Running in 362e5cad33ed
setup hypervisor to run the cluster
Usage:
crc setup [flags]
Flags:
-h, --help help for setup
-d, --vm-driver string The driver to use for the CRC VM. Possible values: [libvirt virtualbox] (default "libvirt")
Global Flags:
-f, --force Forcefully perform an action
--log-level string log level (e.g. "debug | info | warn | error") (default "info")
Removing intermediate container 362e5cad33ed
---> c71b335e661b
Step 21/22 : RUN crc setup
---> Running in b00e42e4446a
level=info msg="Checking if NetworkManager is installed"
level=info msg="Checking if NetworkManager service is running"
level=fatal msg="NetworkManager is required. Please make sure it is installed and running manually"
ERROR: Service 'minishift' failed to build: The command '/bin/sh -c crc setup' returned a non-zero code: 1
じゃあFedoraでやってみますかねぇ~(笑)