4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Docker で Gentoo コンテナを起動する

Posted at

普段は macOS を使っていますが, Gentoo を使いたくなるときがちょいちょいあります.
漢なら stage1 からでしょ?とかとか突っ込まれそうですが, Gentoo is 選択 ということでこれはこれで.

1. Dockerfile を作る

Dockerfile
FROM gentoo/portage:latest as portage

FROM gentoo/stage3-amd64:latest

COPY --from=portage /usr/portage /usr/portage

# make.conf
RUN echo "USE=\"\${USE} -X\"" >> /etc/portage/make.conf && \
    echo "GENTOO_MIRRORS=\"rsync://rsync.jp.gentoo.org/gentoo-portage/ \${GENTOO_MIRRORS}\"" >> /etc/portage/make.conf

# timezone
RUN echo 'Asia/Tokyo' > /etc/timezone && emerge --config timezone-data

make.conf に MAKEOPTS, EMERGE_DEFAULT_OPTS, FEATURES を追加してもよいでしょう. USE フラグの取捨選択はお好みで.

2. コンテナを起動する

$ docker build . -t gentoo && docker run --rm -it --name gentoo -d gentoo && docker exec -it gentoo /bin/bash
# ...
f6a4d3c38040 / #

ちな, rm オプションつけてるんで, $ docker stop gentoo をしない限り exit で抜けてもデータは残ってるよ.

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?