0

状況

buildah でコンテナー イメージをビルドしようとすると、次のエラーが発生します。

[1/2] STEP 7/8: RUN npm install
error running container: error from crun creating container for [/bin/sh -c npm install]: writing file `/sys/fs/cgroup/cgroup.subtree_control`: Operation not supported

環境・手順

  1. buildahというubuntuコンテナイメージにインストールしましたtools-image
  2. このtools-imageコンテナーを macOS で実行します
  3. docker を使用してtool-imageコンテナを実行します
  4. tools-imageコンテナを開始します
docker run -it --privileged --name demo -v "$(pwd)":/localmachine
    "myname/myname:v1" /bin/bash
  1. 内部で使用してコンテナ イメージtools-image buildahを構築しますexample application
buildah bud -t test:v1 -f Dockerfile .

コマンドexample applicationで使用するコンテナー イメージの Dockerfilebuildah bud

これはDockerfileです。

##############################
#           BUILD
##############################
FROM docker.io/node:17-alpine as BUILD 
COPY src /usr/src/app/src
COPY public /usr/src/app/public
COPY package.json /usr/src/app/
COPY babel.config.js /usr/src/app/
WORKDIR /usr/src/app/
RUN npm install
RUN npm run build

##############################
#           EXAMPLE
##############################
# https://blog.openshift.com/deploy-vuejs-applications-on-openshift/
FROM docker.io/nginx:1.21.4-alpine

RUN apk update \
    apk upgrade \
    apk add --update coreutils

# Add a user how will have the rights to change the files in code
RUN addgroup -g 1500 nginxusers 
RUN adduser --disabled-password -u 1501 nginxuser nginxusers 

# Configure ngnix server
COPY nginx-os4-webapp.conf /etc/nginx/nginx.conf
WORKDIR /code
COPY --from=BUILD /usr/src/app/dist .

# https://zingzai.medium.com/externalise-and-configure-frontend-environment-variables-on-kubernetes-e8e798285b3e
# Configure web-app for environment variable usage
WORKDIR /
COPY docker_entrypoint.sh .
COPY generate_env-config.sh .
RUN chown nginxuser:nginxusers docker_entrypoint.sh
RUN chown nginxuser:nginxusers generate_env-config.sh
RUN chmod 777 docker_entrypoint.sh generate_env-config.sh
RUN chown -R nginxuser:nginxusers /code
RUN chown -R nginxuser:nginxusers /etc/nginx
RUN chown -R nginxuser:nginxusers /tmp
RUN chmod 777 /code
RUN chmod 777 /tmp
RUN chmod 777 /etc/nginx

USER nginxuser

EXPOSE 8080
CMD ["/bin/sh","docker_entrypoint.sh"]

実行時のエラー

[1/2] STEP 1/8: FROM docker.io/node:12-alpine AS BUILD
[1/2] STEP 2/8: COPY src /usr/src/app/src
--> d6601e0d631
[1/2] STEP 3/8: COPY public /usr/src/app/public
--> febd88b92b3
[1/2] STEP 4/8: COPY package.json /usr/src/app/
--> 26675130145
[1/2] STEP 5/8: COPY babel.config.js /usr/src/app/
--> 1006f1e8cf3
[1/2] STEP 6/8: WORKDIR /usr/src/app/
--> af1b28ef62c
[1/2] STEP 7/8: RUN npm install
error running container: error from crun creating container for [/bin/sh -c npm install]: writing file `/sys/fs/cgroup/cgroup.subtree_control`: Operation not supported
: exit status 1
[2/2] STEP 1/22: FROM docker.io/nginx:1.21.4-alpine
Trying to pull docker.io/library/nginx:1.21.4-alpine...
error building at STEP "RUN npm install": error while running runtime: exit status 1
4

1 に答える 1