{"id":15686266,"url":"https://github.com/developer-guy/podman-for-macos-tutorial","last_synced_at":"2025-04-28T16:46:18.546Z","repository":{"id":104881228,"uuid":"335753339","full_name":"developer-guy/podman-for-macos-tutorial","owner":"developer-guy","description":"Demonstration of how you can use Podman on your macOS environment","archived":false,"fork":false,"pushed_at":"2021-02-03T22:06:21.000Z","size":16,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T11:27:13.805Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/developer-guy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-03T20:58:24.000Z","updated_at":"2021-09-03T07:05:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"7edf6908-688d-4b48-9ebc-d7898cc745fe","html_url":"https://github.com/developer-guy/podman-for-macos-tutorial","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-guy%2Fpodman-for-macos-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-guy%2Fpodman-for-macos-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-guy%2Fpodman-for-macos-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-guy%2Fpodman-for-macos-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developer-guy","download_url":"https://codeload.github.com/developer-guy/podman-for-macos-tutorial/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251348237,"owners_count":21575246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T17:37:10.408Z","updated_at":"2025-04-28T16:46:18.521Z","avatar_url":"https://github.com/developer-guy.png","language":"Dockerfile","readme":"# podman-for-macos-tutorial\nDemonstration of how you can use Podman on your macOS environment\n\n# Description\n\nThe core Podman runtime environment only runs on Linux operating systems. Other operating systems can use remote client software to manage containers on a Linux backend. The remote client is nearly identical to the standard Podman program. Certain functions that do not make sense for remote clients have been removed. For example, the --latest switch for container commands is not present.\n\n\u003e More detail: https://www.redhat.com/sysadmin/podman-clients-macos-windows\n\n# Getting started\nThere is a software called \"Podman Machine\" to easily setup a VM that you can use as remote Podman server. Podman-machine starts a virtual machine that already streamlines the Podman, Buildah, and skopeo packages. The developers released two VM flavors: an in-memory Tiny Core and a Fedora version.\n\nYou have the option of compiling additional driver support for hypervisors like xhyve, but I would recommend VirtualBox as it seems to work more smoothly.\n\n# Lets start\n\nFirst, we need to install the \"podman-machine\" binary to our host.\n```bash\n$ curl -L https://github.com/boot2podman/machine/releases/download/v0.17/podman-machine.darwin-amd64 --output /usr/local/bin/podman-machine\nchmod +x /usr/local/bin/podman-machine\n```\nI followed this guide to quickly setup our VM: https://developers.redhat.com/blog/2020/02/12/podman-for-macos-sort-of/. But, we need to do some stuff additional to it. So, use this blog post to only set up the VM itself.\n\nLets create our first VM.\n```bash\n$ podman-machine create --virtualbox-boot2podman-url https://github.com/snowjet/boot2podman-fedora-iso/releases/download/d1bb19f/boot2podman-fedora.iso --virtualbox-memory=\"4096\" remote-podman-server-vm\nRunning pre-create checks...\nCreating machine...\n(remote-podman-server-vm) Downloading /Users/batuhan.apaydin/.local/machine/cache/boot2podman.iso from https://github.com/snowjet/boot2podman-fedora-iso/releases/download/d1bb19f/boot2podman-fedora.iso...\n(remote-podman-server-vm) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%\n(remote-podman-server-vm) Creating VirtualBox VM...\n(remote-podman-server-vm) Creating SSH key...\n(remote-podman-server-vm) Starting the VM...\n(remote-podman-server-vm) Check network to re-create if needed...\n(remote-podman-server-vm) Waiting for an IP...\nWaiting for machine to be running, this may take a few minutes...\nDetecting operating system of created instance...\nWaiting for SSH to be available...\nDetecting the provisioner...\nProvisioning with fedora...\nCopying certs to the local machine directory...\nCopying certs to the remote machine...\nChecking connection to Podman...\nPodman is up and running!\nTo see how to connect your Podman client to Podman server running on this virtual machine, run: podman-machine env remote-podman-server-vm\n```\n\nAfter you set up your VM succesfully, next step is upgrade the VM to update it's podman version in it.\n```bash\n$ podman-machine upgrade remote-podman-server-vm\nWaiting for SSH to be available...\nDetecting the provisioner...\nUpgrading podman..\n```\n\nThen, the last thing that we need to do is enabling the podman.sock on the VM side. To do so, we first ssh to the VM using \"ssh\" command then typing some commands to enable it.\n\n\u003e Enable the Podman service on the server\nBefore performing any Podman client commands, you must enable the podman.sock systemd service on the Linux server. In these examples, we run Podman as a normal, unprivileged user (also known as a rootless user). By default, the rootless socket listens at /run/user/${UID}/podman/podman.sock. You enable this socket permanently using the following command:\u003cbr\u003e\n$ systemctl --user enable podman.socket\u003cbr\u003e\nYou need to enable linger for this user for the socket to work when the user is not logged in.\u003cbr\u003e\n$ sudo loginctl enable-linger $USER\n\n```bash\n$ podman-machine ssh remote-podman-server-vm\nLast login: Wed Feb  3 16:20:08 2021 from 10.0.2.2\n[tc@remote-podman-server-vm ~]$ systemctl --user enable podman.socket\nCreated symlink /home/tc/.config/systemd/user/sockets.target.wants/podman.socket -\u003e /usr/lib/systemd/user/podman.socket.\n[tc@remote-podman-server-vm ~]$ sudo loginctl enable-linger $USER\n[tc@remote-podman-server-vm ~]$ systemctl --user status podman.socket\n* podman.socket - Podman API Socket\n   Loaded: loaded (/usr/lib/systemd/user/podman.socket; enabled; vendor preset: enabled)\n   Active: inactive (dead)\n     Docs: man:podman-system-service(1)\n   Listen: /run/user/1000/podman/podman.sock (Stream)\n[tc@remote-podman-server-vm ~]$ systemctl --user start podman.socket\n[tc@remote-podman-server-vm ~]$ systemctl --user status podman.socket\n* podman.socket - Podman API Socket\n   Loaded: loaded (/usr/lib/systemd/user/podman.socket; enabled; vendor preset: enabled)\n   Active: active (listening) since Wed 2021-02-03 16:29:09 EST; 1s ago\n     Docs: man:podman-system-service(1)\n   Listen: /run/user/1000/podman/podman.sock (Stream)\n   CGroup: /user.slice/user-1000.slice/user@1000.service/podman.socket\n\nFeb 03 16:29:09 remote-podman-server-vm systemd[5509]: Listening on Podman API Socket.\n```\n\nNow, you are done at the VM side. The next thing that we need is configuring our client to connect the podman.sock that is running on the VM side. It is also straightforward by the way. There is sub-command exists called \"system\" to do this kind of configuration.\nFirst, we need to look the details of our VM because we are going to use them while configuring our client\n```bash\n$ podman-machine env remote-podman-server-vm\nexport PODMAN_USER=\"root\"\nexport PODMAN_HOST=\"127.0.0.1\"\nexport PODMAN_PORT=\"60146\"\nexport PODMAN_IDENTITY_FILE=\"/Users/batuhan.apaydin/.local/machine/machines/remote-podman-server-vm/id_rsa\"\nexport PODMAN_IGNORE_HOSTS=\"true\"\nexport PODMAN_MACHINE_NAME=\"remote-podman-server-vm\"\n# Run this command to configure your shell:\n# eval $(podman-machine env remote-podman-server-vm)\n```\n\nLets configure our client, to do so first install the podman binary to our host with the make use of brew.\n```bash\n$ brew install podman\n$ podman-machine ip remote-podman-server-vm\n192.168.99.102\n$  podman system connection add fedbox-remote --identity ~/.local/machine/machines/remote-podman-server-vm/id_rsa ssh://root@192.168.99.102:22/run/user/1000/podman/podman.sock\n$ podman system connection list\nName            Identity                                                      URI\nfedbox-remote*  /Users/batuhan.apaydin/.local/machine/machines/remote-podman-server-vm/id_rsa  ssh://root@192.168.99.102:22/run/user/1000/podman/podman.sock\n```\n\nWe can use to create and run our image using podman now.\n```bash\n$ podman image build -t hello-world:v1 .\nSTEP 1: FROM golang:1.15.7-alpine AS build\nGetting image source signatures\nCopying blob sha256:6422294da7d35128e72551ecf15f3a4d9577e5cfa516b6d62fe8b841a9470cb3\nCopying blob sha256:4c0d98bf9879488e0407f897d9dd4bf758555a78e39675e72b5124ccf12c2580\nCopying blob sha256:9e181322f1e7b3ebee5deeef0af7d13619801172e91d2d73dcf79b5d53d82d91\nCopying blob sha256:8b36f00a8e74ce31a867744519cc5db8c4aaeb181cffcda1b4d8269b1cc7f336\nCopying blob sha256:5e5ebcc3e85238e4fbf5ab2428f9ed61dcede6c59b605d56b2f02fb991c70850\nCopying config sha256:54d042506068c9699d4236315fa76ea8789415c1079bcaff35fb3730ea649547\nWriting manifest to image destination\nStoring signatures\nSTEP 2: WORKDIR /app\nSTEP 3: ENV CGO_ENABLED=0     GOOS=linux     GOARCH=amd64\nSTEP 4: COPY ./ ./\nSTEP 5: RUN go build -o hello-world\nSTEP 6: FROM scratch\nSTEP 7: COPY --from=build /app/hello-world ./\nSTEP 8: ENTRYPOINT [\"./hello-world\"]\nSTEP 9: COMMIT hello-world:v1\nGetting image source signatures\nCopying blob sha256:39bc0239cca0d6772ddfd0870ed9a7e59e9a34326b95f1676b99d48112a61d36\nCopying config sha256:693f668c708e56bb5eb7610187851b20c8ca0560716a5a5d6d5b7c202a9db13f\nWriting manifest to image destination\nStoring signatures\n--\u003e 693f668c708\n693f668c708e56bb5eb7610187851b20c8ca0560716a5a5d6d5b7c202a9db13f\n$ podman image list\nREPOSITORY                     TAG            IMAGE ID      CREATED             SIZE\nlocalhost/hello-world          v1             693f668c708e  About a minute ago  2.03 MB\ndocker.io/library/golang       1.15.7-alpine  54d042506068  5 days ago          308 MB\ndocker.io/library/hello-world  latest         bf756fb1ae65  13 months ago       20 kB\n```\n\nLets run the container\n```bash\n$ podman container run hello-world:v1\nHello World Podman!!\n```\n# References\n* https://itnext.io/podman-and-skopeo-on-macos-1b3b9cf21e60\n* https://developers.redhat.com/blog/2020/02/12/podman-for-macos-sort-of/\n* https://www.redhat.com/sysadmin/podman-clients-macos-windows\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloper-guy%2Fpodman-for-macos-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeveloper-guy%2Fpodman-for-macos-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloper-guy%2Fpodman-for-macos-tutorial/lists"}