|
1 | | -## The following are Podman specific steps used to set up on a MacBook (Intel or Apple Silicon) |
| 1 | +# Configuring Podman for Tilt |
2 | 2 |
|
3 | | -### Verify installed tools (install if needed) |
| 3 | +## Verify installed tools (install if needed) |
| 4 | + |
| 5 | +Ensure you have installed [Podman](https://podman.io/), [Kind](https://github.com/kubernetes-sigs/kind/), and [Tilt](https://tilt.dev/). |
4 | 6 |
|
5 | 7 | ```sh |
6 | 8 | $ podman --version |
7 | 9 | podman version 5.0.1 |
8 | 10 | $ kind version |
9 | 11 | kind v0.23.0 go1.22.3 darwin/arm64 |
10 | | - |
11 | | -(optional) |
12 | 12 | $ tilt version |
13 | 13 | v0.33.12, built 2024-03-28 |
14 | 14 | ``` |
15 | 15 |
|
16 | | -### Start Kind with a local registry |
| 16 | +## Start Kind with a local registry |
| 17 | + |
17 | 18 | Use this [helper script](./kind-with-registry-podman.sh) to create a local single-node Kind cluster with an attached local image registry. |
18 | 19 |
|
19 | | -#### Disable secure access on the local kind registry: |
20 | 20 |
|
21 | | -`podman inspect kind-registry --format '{{.NetworkSettings.Ports}}'` |
| 21 | +## Disable secure access on the local kind registry: |
22 | 22 |
|
23 | | -With the port you find for 127.0.0.1 edit the Podman machine's config file: |
| 23 | +Verify the port used by the image registry: |
24 | 24 |
|
25 | | -`podman machine ssh` |
| 25 | +```sh |
| 26 | +podman inspect kind-registry --format '{{.NetworkSettings.Ports}}' |
| 27 | +``` |
26 | 28 |
|
27 | | -`sudo vi /etc/containers/registries.conf.d/100-kind.conf` |
| 29 | +If your host is a Mac, first run: |
| 30 | +`podman machine ssh` |
28 | 31 |
|
29 | | -Should look like: |
| 32 | +Edit `/etc/containers/registries.conf.d/100-kind.conf` so it contains the following, substituting 5001 if your registry is using a different port: |
30 | 33 |
|
31 | 34 | ```ini |
32 | 35 | [[registry]] |
33 | 36 | location = "localhost:5001" |
34 | 37 | insecure = true |
35 | 38 | ``` |
36 | 39 |
|
37 | | -### export DOCKER_HOST |
| 40 | +## Configure the Podman socket |
38 | 41 |
|
39 | | -`export DOCKER_HOST=unix:///var/run/docker.sock` |
| 42 | +Tilt needs to connect to the Podman socket to initiate image builds. The socket address can differ |
| 43 | +depending on your host OS and whether you want to use rootful or rootless Podman. If you're not sure, |
| 44 | +you should use rootless. |
40 | 45 |
|
| 46 | +You can start the rootless Podman socket by running `podman --user start podman.socket`. |
| 47 | +If you would like to automatically start the socket in your user session, you can run |
| 48 | +`systemctl --user enable --now podman.socket`. |
41 | 49 |
|
42 | | -### Optional - Start tilt with the tilt file in the parent directory |
| 50 | +Find the location of your user socket with `systemctl --user status podman.socket`: |
43 | 51 |
|
44 | | -`DOCKER_BUILDKIT=0 tilt up` |
| 52 | +```sh |
| 53 | +● podman.socket - Podman API Socket |
| 54 | + Loaded: loaded (/usr/lib/systemd/user/podman.socket; enabled; preset: disabled) |
| 55 | + Active: active (listening) since Tue 2025-01-28 11:40:50 CST; 7s ago |
| 56 | + Invocation: d9604e587f2a4581bc79cbe4efe9c7e7 |
| 57 | + Triggers: ● podman.service |
| 58 | + Docs: man:podman-system-service(1) |
| 59 | + Listen: /run/user/1000/podman/podman.sock (Stream) |
| 60 | + CGroup: /user.slice/user-1000.slice/ [email protected]/app.slice/podman.socket |
| 61 | +``` |
| 62 | + |
| 63 | +The location of the socket is shown in the `Listen` section, which in the example above |
| 64 | +is `/run/user/1000/podman/podman.sock`. |
45 | 65 |
|
46 | | -### Optional troubleshooting |
| 66 | +Set `DOCKER_HOST` to a unix address at the socket location: |
47 | 67 |
|
48 | | -In some cases it may be needed to do |
| 68 | +```sh |
| 69 | +export DOCKER_HOST=unix:///run/user/1000/podman/podman.sock |
49 | 70 | ``` |
50 | | -sudo podman-mac-helper install |
| 71 | + |
| 72 | +Some systems might symlink the Podman socket to a docker socket, in which case |
| 73 | +you might need to try something like: |
| 74 | + |
| 75 | +```sh |
| 76 | +export DOCKER_HOST=unix:///var/run/docker.sock |
51 | 77 | ``` |
| 78 | + |
| 79 | +## Start Tilt |
| 80 | + |
| 81 | +Running Tilt with a container engine other than Docker requires setting `DOCKER_BUILDKIT=0`. |
| 82 | +You can export this, or just run: |
| 83 | + |
| 84 | +```sh |
| 85 | +DOCKER_BUILDKIT=0 tilt up |
52 | 86 | ``` |
| 87 | + |
| 88 | +## MacOS Troubleshooting |
| 89 | + |
| 90 | +In some cases you might need to run: |
| 91 | + |
| 92 | +```sh |
| 93 | +sudo podman-mac-helper install |
| 94 | + |
53 | 95 | podman machine stop/start |
54 | 96 | ``` |
0 commit comments