Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐳 ➡ 🦭 Replace Docker with Podman #409

Merged
merged 9 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
Personal dotfiles that can be placed in the public repository\
Also known as [盆栽(bonsai)](https://en.wikipedia.org/wiki/Bonsai) 🌳

## Installation - Linux, Darwin
## Installation - Linux(Ubuntu), Darwin

1. Install some dependencies without nix
```bash
# "shadow" in nixpkg is not enough for podman - https://github.com/NixOS/nixpkgs/issues/138423
sudo apt-get install uidmap
```
1. Install [Nix](https://nixos.org/) package manager with [DeterminateSystems/nix-installer](https://github.com/DeterminateSystems/nix-installer).
```bash
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
Expand All @@ -30,7 +35,6 @@ Also known as [盆栽(bonsai)](https://en.wikipedia.org/wiki/Bonsai) 🌳
```bash
nix run 'github:kachick/dotfiles#sudo_enable_nix_login_shells'
```
1. If you have any problems with the installation steps, check both the [CI](.github/workflows/ci-home.yml) and the [wiki](https://github.com/kachick/dotfiles/wiki) and update them.
1. If you are developing this repository, the simple reactivation is as follows.
```bash
makers apply
Expand All @@ -52,3 +56,7 @@ I don't care and make no guarantees for your trouble. But I'm using the followin
## Installation - Windows

Read [the tips](config/windows/README.md)

## If you encounter errors

Check both the [CI](.github/workflows/ci-home.yml) and the [wiki](https://github.com/kachick/dotfiles/wiki) and update them.
36 changes: 0 additions & 36 deletions cmd/setup_wsl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,11 @@ import (
"fmt"
"log"
"os"
"os/exec"
"strings"

"github.com/kachick/dotfiles/internal/fileutils"

"golang.org/x/sys/unix"
)

func freeze(path string) error {
// Using IoctlSetPointerInt changed as immutable, but it returns "operation not supported" error. I don't know the detail
_, err := exec.Command("chattr", "+i", path).Output()
return err
}

// Exists for remember https://github.com/kachick/dotfiles/pull/264#discussion_r1289600371
func mustActivateSystemDOnWSL() {
const path = "/etc/wsl.conf"
Expand Down Expand Up @@ -62,32 +53,6 @@ See https://learn.microsoft.com/ja-jp/windows/wsl/systemd for further detail
}
}

// https://github.com/docker/for-win/issues/8336#issuecomment-718369597
func mustPersistDockerZshCompletions() {
const completionLoadablePath = "/usr/share/zsh/vendor-completions/_docker"
err := os.Remove(completionLoadablePath)
if err != nil {
if os.IsNotExist(err) {
log.Println("info - zsh completions files for docker not found, docker-desktop may not be executed")
} else {
log.Panicf("%+v\n", err)
}
}
// Can't make immutable symlink, so copy and make immutable here
// https://unix.stackexchange.com/questions/586430/how-to-make-a-symlink-read-only-chattr-i-location-symlink
err = fileutils.Copy{Src: "dependencies/docker/zsh-vendor-completions.zsh", Dst: completionLoadablePath}.Run()
if err != nil {
log.Panicf("%+v\n", err)
}

err = freeze(completionLoadablePath)
if err != nil {
log.Panicf("%+v\n", err)
}

fmt.Printf("Done! docker comletions for zsh %s has been replaced to immutable file", completionLoadablePath)
}

// This script requires sudo execution
func main() {
// wsl.exe returns non English even in called on the VM https://github.com/microsoft/WSL/issues/9242
Expand All @@ -107,5 +72,4 @@ func main() {
}

mustActivateSystemDOnWSL()
mustPersistDockerZshCompletions()
}
7 changes: 7 additions & 0 deletions config/windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,10 @@ Cons for Microsoft IME
## How to completely disable Microsoft IME after installed Google Japanese Input?

[#300](https://github.com/kachick/dotfiles/issues/300) is the steps.

## Containers?

I now prefer podman over docker and singularity.\
It needs special WSL distribution. How to run it from standard WSL ubuntu is written in [this document](https://podman-desktop.io/docs/podman/accessing-podman-from-another-wsl-instance).\
Make sure you are using podman binary as podman-remote, nixpkgs product does not satisfy.\
This repository aliases podman command to mise installed binary.
5 changes: 4 additions & 1 deletion config/windows/winget/winget-pkgs-basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
"PackageIdentifier": "Canonical.Ubuntu.2204"
},
{
"PackageIdentifier": "Docker.DockerDesktop"
"PackageIdentifier": "RedHat.Podman"
},
{
"PackageIdentifier": "RedHat.Podman-Desktop"
},
{
"PackageIdentifier": "Microsoft.WindowsTerminal"
Expand Down
Loading
Loading