How to Display Docker and Kubernetes Symbols in Starship Prompts?

 garuda-inxi
System:
  Kernel: 6.6.46-1-lts arch: x86_64 bits: 64 compiler: gcc v: 14.2.1 clocksource: tsc
    avail: acpi_pm parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-lts
    root=UUID=5a0c41fe-8e4c-41ad-b9a3-8bc592e3dd5d rw rootflags=subvol=@ quiet loglevel=3 ibt=off
  Console: pty pts/1 DM: SDDM Distro: Garuda base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 21E4S2WT00 v: ThinkPad E14 Gen 4
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: LENOVO model: 21E4S2WT00 serial: <superuser required>
    part-nu: LENOVO_MT_21E4_BU_Think_FM_ThinkPad E14 Gen 4 uuid: <superuser required> UEFI: LENOVO
    v: R1SET55W(1.26) date: 01/23/2024
Battery:
  ID-1: BAT0 charge: 31.4 Wh (55.1%) condition: 57.0/57.0 Wh (100.0%) power: 10.0 W volts: 11.6
    min: 11.5 model: LGES LNV-5B11E24665 type: Li-poly serial: <filter> status: discharging
    cycles: 4
CPU:
  Info: model: 12th Gen Intel Core i5-1235U bits: 64 type: MST AMCP arch: Alder Lake level: v3
    note: check built: 2021+ process: Intel 7 (10nm ESF) family: 6 model-id: 0x9A (154) stepping: 4
    microcode: 0x433
  Topology: cpus: 1x cores: 10 mt: 2 tpc: 2 st: 8 threads: 12 smt: enabled cache: L1: 928 KiB
    desc: d-8x32 KiB, 2x48 KiB; i-2x32 KiB, 8x64 KiB L2: 6.5 MiB desc: 2x1.2 MiB, 2x2 MiB L3: 12 MiB
    desc: 1x12 MiB
  Speed (MHz): avg: 576 high: 2521 min/max: 400/4400:3300 scaling: driver: intel_pstate
    governor: powersave cores: 1: 400 2: 400 3: 2521 4: 400 5: 400 6: 400 7: 400 8: 400 9: 400
    10: 400 11: 400 12: 400 bogomips: 59916
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3
  Vulnerabilities: <filter>
Graphics:
  Device-1: Intel Alder Lake-UP3 GT2 [Iris Xe Graphics] vendor: Lenovo driver: i915 v: kernel
    arch: Gen-12.2 process: Intel 10nm built: 2021-22+ ports: active: none off: eDP-1
    empty: DP-1,DP-2,HDMI-A-1 bus-ID: 00:02.0 chip-ID: 8086:46a8 class-ID: 0300
  Device-2: Bison Integrated RGB Camera driver: uvcvideo type: USB rev: 2.0 speed: 480 Mb/s
    lanes: 1 mode: 2.0 bus-ID: 3-7:3 chip-ID: 5986:2146 class-ID: fe01 serial: <filter>
  Display: server: X.org v: 1.21.1.13 with: Xwayland v: 24.1.2 compositor: kwin_wayland driver:
    X: loaded: modesetting alternate: fbdev,intel,vesa dri: iris gpu: i915 tty: 120x30
  Monitor-1: eDP-1 model: AU Optronics 0x408d built: 2019 res: 1920x1080 dpi: 158 gamma: 1.2
    size: 309x174mm (12.17x6.85") diag: 355mm (14") ratio: 16:9 modes: 1920x1080
  API: EGL v: 1.5 hw: drv: intel iris platforms: device: 0 drv: iris device: 1 drv: swrast gbm:
    drv: iris surfaceless: drv: iris wayland: drv: iris inactive: x11
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: mesa v: 24.1.6-arch1.1 note: console (EGL sourced)
    renderer: Mesa Intel Graphics (ADL GT2), llvmpipe (LLVM 18.1.8 256 bits)
  API: Vulkan v: 1.3.279 layers: 3 device: 0 type: integrated-gpu name: Intel Graphics (ADL GT2)
    driver: mesa intel v: 24.1.6-arch1.1 device-ID: 8086:46a8 surfaces: wayland device: 1 type: cpu
    name: llvmpipe (LLVM 18.1.8 256 bits) driver: mesa llvmpipe v: 24.1.6-arch1.1 (LLVM 18.1.8)
    device-ID: 10005:0000 surfaces: wayland
Audio:
  Device-1: Intel Alder Lake PCH-P High Definition Audio vendor: Lenovo
    driver: sof-audio-pci-intel-tgl alternate: snd_hda_intel,snd_sof_pci_intel_tgl bus-ID: 00:1f.3
    chip-ID: 8086:51c8 class-ID: 0401
  API: ALSA v: k6.6.46-1-lts status: kernel-api tools: N/A
  Server-1: PipeWire v: 1.2.2 status: active with: 1: pipewire-pulse status: active
    2: wireplumber status: active 3: pipewire-alsa type: plugin 4: pw-jack type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel Alder Lake-P PCH CNVi WiFi driver: iwlwifi v: kernel bus-ID: 00:14.3
    chip-ID: 8086:51f0 class-ID: 0280
  IF: wlp0s20f3 state: up mac: <filter>
  Device-2: Intel Ethernet I219-V vendor: Lenovo driver: e1000e v: kernel port: N/A
    bus-ID: 00:1f.6 chip-ID: 8086:1a1f class-ID: 0200
  IF: enp0s31f6 state: down mac: <filter>
  IF-ID-1: docker0 state: down mac: <filter>
  Info: services: NetworkManager, sshd, systemd-timesyncd, wpa_supplicant
Bluetooth:
  Device-1: Intel AX201 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0 speed: 12 Mb/s lanes: 1
    mode: 1.1 bus-ID: 3-10:4 chip-ID: 8087:0026 class-ID: e001
  Report: btmgmt ID: hci0 rfk-id: 1 state: down bt-service: enabled,running rfk-block:
    hardware: no software: no address: <filter> bt-v: 5.2 lmp-v: 11 status: discoverable: no
    pairing: no
Drives:
  Local Storage: total: 953.87 GiB used: 34.58 GiB (3.6%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Transcend model: TS1TMTE400S size: 953.87 GiB
    block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: V0804S3 temp: 39.9 C scheme: GPT
Partition:
  ID-1: / raw-size: 953.57 GiB size: 953.57 GiB (100.00%) used: 34.58 GiB (3.6%) fs: btrfs
    dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%) used: 584 KiB (0.2%) fs: vfat
    dev: /dev/nvme0n1p1 maj-min: 259:1
  ID-3: /home raw-size: 953.57 GiB size: 953.57 GiB (100.00%) used: 34.58 GiB (3.6%) fs: btrfs
    dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-4: /var/log raw-size: 953.57 GiB size: 953.57 GiB (100.00%) used: 34.58 GiB (3.6%)
    fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-5: /var/tmp raw-size: 953.57 GiB size: 953.57 GiB (100.00%) used: 34.58 GiB (3.6%)
    fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: zram size: 23.16 GiB used: 57.5 MiB (0.2%) priority: 100 comp: zstd
    avail: lzo,lzo-rle,lz4,lz4hc,842 max-streams: 12 dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 43.0 C mobo: N/A
  Fan Speeds (rpm): fan-1: 0 fan-2: 0
Info:
  Memory: total: 24 GiB note: est. available: 23.16 GiB used: 4.31 GiB (18.6%)
  Processes: 306 Power: uptime: 7h 29m states: freeze,mem,disk suspend: s2idle wakeups: 1
    hibernate: platform avail: shutdown, reboot, suspend, test_resume image: 9.25 GiB
    services: org_kde_powerdevil, power-profiles-daemon, upowerd Init: systemd v: 256
    default: graphical tool: systemctl
  Packages: pm: pacman pkgs: 1397 libs: 393 tools: octopi,paru Compilers: gcc: 14.2.1
    Shell: garuda-inxi default: fish v: 3.7.1 running-in: pty pts/1 (SSH) inxi: 3.3.35
Garuda (2.6.26-1):
  System install date:     2024-08-17
  Last full system update: 2024-08-19 ↻
  Is partially upgraded:   No
  Relevant software:       timeshift NetworkManager dracut
  Windows dual boot:       Probably (Run as root to verify)
  Failed units:

Hello, good day.

My issue is with Starship prompts. I want the Docker symbol to appear when I use commands like docker and docker-compose, and the Kubernetes symbol to appear when I use the kubectl command. However, I haven’t been able to figure out how to do this. Could you please help me?

Thank you.

Have you thought about reading Configuration | Starship

This Section on Kubernetes: Configuration | Starship
This Section on Docker: Configuration | Starship

1 Like

Actually I read it but I didn’t understand it. I think I’m bad at this

❯ cat .config/starship.toml
## FIRST LINE/ROW: Info & Status
# First param ─┌
[username]
format = "[$user]($style)@"
show_always = true
style_root = "bold #50FA7B"
style_user = "bold #50FA7B"

# Second param
[hostname]
disabled = false
format = "[$hostname]($style) in "
ssh_only = false
style = "bold #FF79C6"
trim_at = "-"

# Third param
[directory]
style = "bold #FFB86C"
truncate_to_repo = true
truncation_length = 0
truncation_symbol = "repo: "

# Fourth param
[sudo]
disabled = false

# Before all the version info (python, nodejs, php, etc.)
[git_status]
ahead = "⇡${count}"
behind = "⇣${count}"
deleted = "x"
diverged = "⇕⇡${ahead_count}⇣${behind_count}"
style = "bold #BD93F9"

# Last param in the first line/row
[cmd_duration]
disabled = true
format = "took [$duration]($style)"
min_time = 1

## SECOND LINE/ROW: Prompt
# Somethere at the beginning
[battery]
charging_symbol = ""
disabled = true
discharging_symbol = ""
full_symbol = ""

[[battery.display]] # "bold red" style when capacity is between 0% and 15%
disabled = true
style = "bold red"
threshold = 15

[[battery.display]] # "bold yellow" style when capacity is between 15% and 50%
disabled = true
style = "bold yellow"
threshold = 50

[[battery.display]] # "bold green" style when capacity is between 50% and 80%
disabled = true
style = "bold green"
threshold = 80

# Prompt: optional param 1
[time]
disabled = true
format = " 🕙 $time($style)\n"
style = "bright-white"
time_format = "%T"

# Prompt: param 2
[character]
#error_symbol = " [×](bold red)"
#success_symbol = " [╰─λ](bold red)"

# SYMBOLS
[status]
disabled = false
format = '[\[$symbol$status_common_meaning$status_signal_name$status_maybe_int\]]($style)'
map_symbol = true
pipestatus = true
symbol = "🔴"

[aws]
symbol = " "

[conda]
symbol = " "

[dart]
symbol = " "

[docker_context]
disabled = false
format = 'via [🐋 $context](blue bold)'
#symbol = " "

I see docker already in your config.

[docker_context]
symbol = ""

Maybe you should add

[[kubernets]                                                                                                                                                                  
symbol = "<put a kubernetes symbol here "
1 Like
shyuuhei@FoxHound in ~/deneme 󱁢 default
❯ ls
.rw-r--r-- 0 shyuuhei 19 Ağu 22:21  docker-compose.yaml
.rw-r--r-- 0 shyuuhei 19 Ağu 22:11  docker-compose.yml
.rw-r--r-- 0 shyuuhei 19 Ağu 22:11  Dockerfile
.rw-r--r-- 0 shyuuhei 19 Ağu 22:42 󱁢 main.tf

i think my problem is related to docker because i don’t have problem with php, python, terraform etc.

Reboot. Then complain.

1 Like