Closed4
Apple Containerを試す

Apple Container を試す。
$ uname -a
Darwin MacBook-Air.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:34 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T8103 arm64
$ sw_vers
ProductName: macOS
ProductVersion: 15.6.1
BuildVersion: 24G90

セットアップ
インストール
Homebrewでインストールする。
brew install container
$ container --version
container CLI version 0.4.1 (build: release, commit: 4ac18b5)
サービスの有効化
サービスを有効化する。
container system start
カーネルのインストールをするか尋ねられたので、そのまま y
でインストールした。
$ container system start
Verifying apiserver is running...
No default kernel configured.
Install the recommended default kernel from [https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz]? [Y/n]: y
Installing kernel...
ステータスを確認、問題なし。
$ container system status
apiserver is running
application data root: /Users/koyashiro/Library/Application Support/com.apple.container/
application install root: /usr/local/
container-apiserver version: container-apiserver version 0.4.1 (build: release, commit: 4ac18b5)
container-apiserver commit: 4ac18b54f376b03ce24448abdd86a4a3371bad43

hello-world
イメージの実行
hello-world イメージを実行してみる。
container run --rm -it hello-world:latest
$ container run --rm -it hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(arm64v8)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
なんの問題もなく実行できた。

mysql
イメージの実行
mysql イメージを実行してみる。
container run --rm -it -e 'MYSQL_ROOT_PASSWORD=password' -p 127.0.0.1:3306:3306 mysql:8.4.6
$ container run --rm -it -e 'MYSQL_ROOT_PASSWORD=password' -p 127.0.0.1:3306:3306 mysql:8.4.6
2025-09-10 15:12:19+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.6-1.el9 started.
2025-09-10 15:12:20+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2025-09-10 15:12:20+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.4.6-1.el9 started.
2025-09-10 15:12:20+00:00 [Note] [Entrypoint]: Initializing database files
2025-09-10T15:12:20.221965Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
2025-09-10T15:12:20.222665Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.4.6) initializing of server in progress as process 75
2025-09-10T15:12:20.229214Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-09-10T15:12:20.642701Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-09-10T15:12:21.085087Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2025-09-10T15:12:22.454842Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end.
2025-09-10 15:12:22+00:00 [Note] [Entrypoint]: Database files initialized
2025-09-10 15:12:22+00:00 [Note] [Entrypoint]: Starting temporary server
mysqld will log errors to /var/lib/mysql/fa5bbbaa-486a-48c9-9820-637816fffa30.err
mysqld is running as pid 118
2025-09-10 15:12:23+00:00 [Note] [Entrypoint]: Temporary server started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2025-09-10 15:12:24+00:00 [Note] [Entrypoint]: Stopping temporary server
2025-09-10 15:12:26+00:00 [Note] [Entrypoint]: Temporary server stopped
2025-09-10 15:12:26+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
2025-09-10T15:12:26.087839Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2025-09-10T15:12:26.242950Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.4.6) starting as process 1
2025-09-10T15:12:26.245940Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-09-10T15:12:26.373266Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-09-10T15:12:26.525088Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2025-09-10T15:12:26.525111Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2025-09-10T15:12:26.525848Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2025-09-10T15:12:26.540129Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.4.6' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
2025-09-10T15:12:26.540130Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
なんの問題もなく起動した。
CLIでログインしてみる。
container exec -it e5340dc8-9adb-4dab-bfae-acf068d2c33b mysql -h127.0.0.1 -uroot -ppassword
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.4.6 |
+-----------+
1 row in set (0.00 sec)
こちらも問題なし。
このスクラップは27日前にクローズされました