Toolbox: μ»¨ν…Œμ΄λ„ˆλŠ” μ’…λ£Œ 후에도 계속 μ‹€ν–‰ μ€‘μž…λ‹ˆλ‹€.

에 λ§Œλ“  2019λ…„ 04μ›” 13일  Β·  14μ½”λ©˜νŠΈ  Β·  좜처: containers/toolbox

특히, 이것은 podman ν•˜μ—¬ λ¨Όμ € 쀑지/μ’…λ£Œν•˜μ§€ μ•Šκ³ λŠ” 도ꡬ μƒμžμ—μ„œ μƒμ„±λœ μ»¨ν…Œμ΄λ„ˆλ₯Ό μ œκ±°ν•˜λŠ” 것이 λΆˆκ°€λŠ₯ν•˜λ‹€λŠ” 것을 μ˜λ―Έν•©λ‹ˆλ‹€.

 ~/toolbox ξ‚° ./toolbox create -c test
Created container: test
Enter with: toolbox enter --container test
 ~/toolbox ξ‚° ./toolbox enter -c test 
πŸ”Ή[exalm<strong i="7">@toolbox</strong> toolbox]$ logout
 ~/toolbox ξ‚° ./toolbox rm test
toolbox: failed to remove container test
 ~/toolbox ξ‚° podman ps
CONTAINER ID  IMAGE                              COMMAND     CREATED         STATUS             PORTS  NAMES
1a08f09ea797  localhost/fedora-toolbox-exalm:30  sleep +Inf  16 seconds ago  Up 10 seconds ago         test
 ~/toolbox ξ‚° podman stop test
1a08f09ea79710801859bea8dc6a5a85d2031ce1a73dd7d284c3e1fa51a67be0
 ~/toolbox ξ‚° ./toolbox rm test
 ~/toolbox ξ‚° 
1. Bug

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

toolbox rm --force λ₯Ό μ‚¬μš©ν•˜λ©΄ λ‚΄ μ»΄ν“¨ν„°μ—μ„œ μ‹€ν–‰ 쀑인 μ»¨ν…Œμ΄λ„ˆλ₯Ό μ‚­μ œν•  수 μ—†μŠ΅λ‹ˆλ‹€.

μ•„λ§ˆλ„ ν•  수 μžˆλŠ” 일은 μ»¨ν…Œμ΄λ„ˆλ₯Ό μ‚­μ œν•  λ•Œ μ»¨ν…Œμ΄λ„ˆκ°€ μ‹€ν–‰ 쀑인지 κ°μ§€ν•œ λ‹€μŒ This toolbox is currently running, are you sure you wish to delete it [y/N]: 와 같은 ν”„λ‘¬ν”„νŠΈλ₯Ό μ‚¬μš©μžμ—κ²Œ μ œκ³΅ν•œ λ‹€μŒ κ³„μ†ν•˜κΈ°λ‘œ μ„ νƒν•œ 경우 μ‚­μ œ λͺ…령을 ν˜ΈμΆœν•˜κΈ° 전에 podman stop λ₯Ό ν˜ΈμΆœν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€. .

λͺ¨λ“  14 λŒ“κΈ€

toolbox rm --force 도 μž‘λ™ν•΄μ•Ό ν•©λ‹ˆλ‹€.

ν•˜μ§€λ§Œ 예, 이 μ°Έμ‘°λ₯Ό μ μ ˆν•˜κ²Œ κ³„μ‚°ν•˜λ„λ‘ ν•˜κ³  μ‹Άμ§€λ§Œ μŠ¬ν”„κ²Œλ„ κΈ°μ‘΄ Podman λͺ…령쀄 μΈν„°νŽ˜μ΄μŠ€λ₯Ό μ‚¬μš©ν•˜μ—¬ 이λ₯Ό κ΅¬ν˜„ν•˜λŠ” 방법을 λͺ¨λ¦…λ‹ˆλ‹€.

toolbox rm --force λ₯Ό μ‚¬μš©ν•˜λ©΄ λ‚΄ μ»΄ν“¨ν„°μ—μ„œ μ‹€ν–‰ 쀑인 μ»¨ν…Œμ΄λ„ˆλ₯Ό μ‚­μ œν•  수 μ—†μŠ΅λ‹ˆλ‹€.

μ•„λ§ˆλ„ ν•  수 μžˆλŠ” 일은 μ»¨ν…Œμ΄λ„ˆλ₯Ό μ‚­μ œν•  λ•Œ μ»¨ν…Œμ΄λ„ˆκ°€ μ‹€ν–‰ 쀑인지 κ°μ§€ν•œ λ‹€μŒ This toolbox is currently running, are you sure you wish to delete it [y/N]: 와 같은 ν”„λ‘¬ν”„νŠΈλ₯Ό μ‚¬μš©μžμ—κ²Œ μ œκ³΅ν•œ λ‹€μŒ κ³„μ†ν•˜κΈ°λ‘œ μ„ νƒν•œ 경우 μ‚­μ œ λͺ…령을 ν˜ΈμΆœν•˜κΈ° 전에 podman stop λ₯Ό ν˜ΈμΆœν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€. .

toolbox rm --force ν•˜κ³  podman으둜 μ€‘μ§€ν•œ 후에도 toolbox둜 μƒμ„±λœ μ»¨ν…Œμ΄λ„ˆλ₯Ό μ‚­μ œν•  수 μ—†μŠ΅λ‹ˆλ‹€. μž¬λΆ€νŒ…ν•΄μ•Ό toolbox rm μž‘λ™ν•©λ‹ˆλ‹€.

λ„κ΅¬μƒμžμ—μ„œ μƒμ„±ν•œ μ»¨ν…Œμ΄λ„ˆλ₯Ό μ‚¬μš©ν•΄λ„ μ‚­μ œν•  수 μ—†μŠ΅λ‹ˆλ‹€.
toolbox rm --force ν•˜κ³  podman으둜 μ€‘μ§€ν•©λ‹ˆλ‹€. μž¬λΆ€νŒ…ν•΄μ•Όν•©λ‹ˆλ‹€
그런 λ‹€μŒ toolbox rm μž‘λ™ν•©λ‹ˆλ‹€.

ν˜„μž¬ ν™œμ„± toolbox enter μ„Έμ…˜μ΄ 있으면 μ‹€νŒ¨ν•©λ‹ˆλ‹€. κ±°κΈ°μ—μ„œ 였λ₯˜ 처리λ₯Ό κ°œμ„ ν•΄μ•Ό ν•©λ‹ˆλ‹€.

그렇지 μ•Šκ³  λ§ˆμŒλŒ€λ‘œ μž¬μƒμ‚°ν•  수 μžˆλ‹€λ©΄ podman rm --force <container> λ₯Ό μ‹œλ„ν•˜μ—¬ μ»¨ν…Œμ΄λ„ˆλ₯Ό μ‚­μ œν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. 이것도 μ‹€νŒ¨ν•˜λ©΄ Podman 버그가 μžˆμ„ 수 μžˆμŠ΅λ‹ˆλ‹€. μ–΄μ¨Œλ“  λ‹€λ₯Έ 문제λ₯Ό μ‚¬μš©ν•˜μ—¬ 이에 λŒ€ν•΄ λ…Όμ˜ν•΄ λ³΄κ² μŠ΅λ‹ˆλ‹€.

λ“€λŸ¬μ£Όμ…”μ„œ κ°μ‚¬ν•©λ‹ˆλ‹€!

거의 1.5λ…„ μ „μ―€ λ³΄λ„λœ κ±Έ κ°μ•ˆν•˜λ©΄ κ·Έ μ΄ν›„λ‘œ μ–΄λ–€ 진전이 μžˆμ—ˆλŠ”μ§€ κΆκΈˆν•˜λ‹€.

Toolbox 뒀에 남은 μ»¨ν…Œμ΄λ„ˆλ₯Ό 멈좜 수 μ—†λŠ” 것 κ°™μŠ΅λ‹ˆλ‹€.

[bam<strong i="6">@host</strong> ~]$ toolbox list
IMAGE ID      IMAGE NAME                                            CREATED
a198bc8c3cda  registry.fedoraproject.org/f31/fedora-toolbox:31      9 months ago
fe7b8c2393f9  registry.fedoraproject.org/f32/fedora-toolbox:32      4 months ago
3864bc58ab7b  registry.fedoraproject.org/f33/fedora-toolbox:33      4 months ago
b390f0663e2a  registry.fedoraproject.org/f33/fedora-toolbox:latest  2 weeks ago

CONTAINER ID  CONTAINER NAME     CREATED       STATUS      IMAGE NAME
c27048bea726  fedora-toolbox-31  6 months ago  configured  registry.fedoraproject.org/f31/fedora-toolbox:31
f48d171dc79e  fedora-toolbox-32  3 months ago  running     registry.fedoraproject.org/f32/fedora-toolbox:32
...
f429c215fa02  toolbox            3 hours ago   running     registry.fedoraproject.org/f32/fedora-toolbox:32


[bam<strong i="7">@host</strong> ~]$ podman stop fedora-toolbox-32 
2020-08-26T14:33:24.000938739Z: kill process 3459: Operation not permitted
Error: operation not permitted
[bam<strong i="8">@host</strong> ~]$ podman stop toolbox 
2020-08-26T14:33:32.000453021Z: kill process 3318: Operation not permitted
Error: operation not permitted

[bam<strong i="9">@host</strong> ~]$ sudo podman stop toolbox 
[sudo] password for bam: 
Error: no container with name or ID toolbox found: no such container
[bam<strong i="6">@host</strong> ~]$ podman stop fedora-toolbox-32 
2020-08-26T14:33:24.000938739Z: kill process 3459: Operation not permitted
Error: operation not permitted

였λ₯˜μ˜ 원인은 conmon ν•˜μœ„ ν”„λ‘œμ„ΈμŠ€κ°€ μ΄μƒν•œ PID 100000 μ‹€ν–‰λ˜λŠ” 것 κ°™μŠ΅λ‹ˆλ‹€.

bam         3315    1332  0 16:32 ?        Ssl    0:00  \_ /usr/bin/conmon --api-version 1 -c f429c215fa02f617362a0b17c4045eb32d4d8c461c38248fb9e1e0a3d9f1220b -u f429c215fa02f617362a0b17c4045eb32d4d8c461c38248fb
100000      3318    3315  0 16:32 ?        Ss     0:00  |   \_ sleep +Inf
...
bam         3456    1332  0 16:33 ?        Ssl    0:00  \_ /usr/bin/conmon --api-version 1 -c f48d171dc79e0db510fa334827fa5a4693b1f952221bc916666f408d845d5b92 -u f48d171dc79e0db510fa334827fa5a4693b1f952221bc9166
100000      3459    3456  0 16:33 ?        Ss     0:00  |   \_ sleep +Inf
[bam<strong i="14">@host</strong> ~]$ ll /var/home/bam/.local/share/containers/storage/overlay-containers/f429c215fa02f617362a0b17c4045eb32d4d8c461c38248fb9e1e0a3d9f1220b/
total 4
drwx------. 3 100000 100000 4096 Aug 26 16:38 userdata

그것은 λ¬΄μ—‡μž…λ‹ˆκΉŒ? 였λ₯˜μž…λ‹ˆκΉŒ, μ•„λ‹ˆλ©΄ μ˜λ„μ μΈ κ²ƒμž…λ‹ˆκΉŒ?
μ „μžμ˜ 경우 μ»¨ν…Œμ΄λ„ˆλ₯Ό μ–΄λ–»κ²Œ κ³ μΉ  수 μžˆμŠ΅λ‹ˆκΉŒ?

podman stop <container> λŠ” ν™œμ„± toolbox enter λ˜λŠ” podman run μ„Έμ…˜μ΄ μ—†λŠ” ν•œ ν™•μ‹€νžˆ μž‘λ™ν•©λ‹ˆλ‹€.

μ§€κΈˆκΉŒμ§€ Toolbox μ»¨ν…Œμ΄λ„ˆλ₯Ό μ°Έμ‘° κ³„μ‚°ν•˜μ—¬ λ§ˆμ§€λ§‰ toolbox enter λ˜λŠ” toolbox run μ„Έμ…˜μ΄ μ’…λ£Œλ˜λ©΄ μžλ™μœΌλ‘œ μ€‘μ§€λ˜λ„λ‘ ν•˜λŠ” 두 가지 방법을 생각할 수 μžˆμŠ΅λ‹ˆλ‹€.

(μ»¨ν…Œμ΄λ„ˆλ₯Ό μ€‘μ§€ν•˜λŠ” 것은 μ»¨ν…Œμ΄λ„ˆμ˜ μ§„μž…μ  ν”„λ‘œμ„ΈμŠ€λ₯Ό μ’…λ£Œν•˜λŠ” 것과 κ°™μŠ΅λ‹ˆλ‹€.)

  • enter 및 run λͺ…령은 POSIX μ‹ ν˜Έλ₯Ό μ‚¬μš©ν•˜μ—¬ μ»¨ν…Œμ΄λ„ˆμ˜ μ§„μž…μ μ— μƒˆ μ„Έμ…˜μ΄ μ‹œμž‘λ˜κ±°λ‚˜ 방금 μ’…λ£Œλ˜μ—ˆμŒμ„ μ•Œλ¦½λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄, ν•˜λ‚˜λŠ” SIGUSR1 , λ‹€λ₯Έ ν•˜λ‚˜λŠ” SIGUSR2 둜 보낼 수 μžˆμŠ΅λ‹ˆλ‹€. μ§„μž…μ μ€ μ΄λŸ¬ν•œ μ‹ ν˜Έλ₯Ό μ²˜λ¦¬ν•˜κ³  ν™œμ„± μ„Έμ…˜ 수의 μ°Έμ‘° 카운트λ₯Ό μœ μ§€ν•©λ‹ˆλ‹€. μΉ΄μš΄ν„°κ°€ 0에 λ„λ‹¬ν•˜λ©΄ μ’…λ£Œλ©λ‹ˆλ‹€.

이것은 Go 채널, os/signal λ“±μœΌλ‘œ κ΅¬ν˜„ν•  수 μžˆμŠ΅λ‹ˆλ‹€. λ‹€μŒ 은 μ˜ˆμž…λ‹ˆλ‹€.

μ΄κ²ƒμ˜ 단점은 enter 및 run λͺ…λ Ήμ˜ μΆ©λŒμ— λŒ€ν•΄ 탄λ ₯적이지 μ•Šλ‹€λŠ” κ²ƒμž…λ‹ˆλ‹€. 좩돌이 λ°œμƒν•˜λ©΄ μ„Έμ…˜ μ’…λ£Œλ₯Ό λ‚˜νƒ€λ‚΄λŠ” 두 번째 μ‹ ν˜Έκ°€ μ „μ†‘λ˜μ§€ μ•Šμ„ 수 μžˆμŠ΅λ‹ˆλ‹€.

  • enter 및 run μ„Έμ…˜μ€ 곡유 파일 잠금(예: flock --shared ... )을 νšλ“ν•˜κ³  μ§„μž…μ μ€ 독점 잠금(예: flock --exclusive ... ) 곡톡 νŒŒμΌμ— μžˆμŠ΅λ‹ˆλ‹€. λͺ¨λ“  곡유 잠금이 ν™œμ„± μ„Έμ…˜μ—μ„œ ν•΄μ œλ˜λ©΄ μ§„μž…μ μ΄ 차단 ν•΄μ œλ˜κ³  μ’…λ£Œλ  수 μžˆμŠ΅λ‹ˆλ‹€.

이것에 λŒ€ν•œ 쒋은 점은 ν”„λ‘œμ„ΈμŠ€κ°€ μ’…λ£Œλ  λ•Œ 컀널에 μ˜ν•΄ 잠금이 μžλ™μœΌλ‘œ ν•΄μ œλœλ‹€λŠ” κ²ƒμž…λ‹ˆλ‹€. λ”°λΌμ„œ enter 및 run λͺ…령이 μΆ©λŒν•˜λ”λΌλ„ 잠금이 ν•΄μ œλ©λ‹ˆλ‹€.

podman stop <container> λŠ” λ°˜λ“œμ‹œ μž‘λ™ν•΄μ•Ό ν•©λ‹ˆλ‹€.
ν™œμ„± toolbox enter λ˜λŠ” podman run μ„Έμ…˜μ΄ μžˆμŠ΅λ‹ˆλ‹€.

μ—¬μ „νžˆ 그렇지 μ•ŠμœΌλ©° μ‹€ν–‰ 쀑인 μ„Έμ…˜μ΄ μ—†μŠ΅λ‹ˆλ‹€.

이것은 Podman λ²„κ·Έμ²˜λŸΌ λ“€λ¦½λ‹ˆλ‹€.

이것을 λ°˜λ³΅ν•΄μ„œ μž¬ν˜„ν•  수 μžˆλ‹€λ©΄ Podman 버그λ₯Ό μ‹ κ³ ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€. Podman λͺ…λ Ήμ–΄λ§ŒμœΌλ‘œ 이것을 μž¬ν˜„ν•  수 μžˆλ‹€λ©΄ λ”μš± 쒋을 κ²ƒμž…λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄ podman create ... sleep +Inf μ»¨ν…Œμ΄λ„ˆ, podman start ... λ“±μž…λ‹ˆλ‹€.

κ·ΈλŸ¬λ‚˜ 일반 μ‚¬μš©μžμ²˜λŸΌ 100000 PIDλ₯Ό μ‚¬μš©ν•˜μ—¬ ν•΄λ‹Ή μ ˆμ „ ν”„λ‘œμ„ΈμŠ€λ₯Ό μ’…λ£Œν•  수 μžˆμŠ΅λ‹ˆλ‹€.
그런 λ‹€μŒ μ„Έμ…˜μ΄ μ€‘μ§€λ©λ‹ˆλ‹€.
100000 PIDκ°€ μ–΄λ””μ—μ„œ μ™”λŠ”μ§€ μ•„μ‹­λ‹ˆκΉŒ?

PIDκ°€ μ•„λ‹Œ UID라고 μƒκ°ν•©λ‹ˆλ‹€.

μ΄λŸ¬ν•œ UIDλŠ” μ‚¬μš©μž λ„€μž„μŠ€νŽ˜μ΄μŠ€ 내뢀에 있기 λ•Œλ¬Έμ— 크게 λ³΄μž…λ‹ˆλ‹€.

이것을 반볡적으둜 μž¬ν˜„ν•  수 μžˆλ‹€λ©΄

λ‚˜λŠ” μ•„λ‹Œ 것 κ°™λ‹€. 쒋은지 λ‚˜μœμ§€ 잘 λͺ¨λ₯΄κ² μŠ΅λ‹ˆλ‹€ :)
μ–΄μ¨Œλ“  이미 ν¬λ“œλ§¨ 문제λ₯Ό μ œκΈ°ν•˜κ³  μž¬ν˜„ λΆˆκ°€λ‘œ λ§ˆκ°ν–ˆμŠ΅λ‹ˆλ‹€. λ‹€μ‹œ μ§λ©΄ν•˜λ©΄ λ‹€μ‹œ μ—΄κ² μŠ΅λ‹ˆλ‹€.
https://github.com/containers/podman/issues/7463

PIDκ°€ μ•„λ‹Œ UID라고 μƒκ°ν•©λ‹ˆλ‹€.

μ΄λŸ¬ν•œ UIDλŠ” μ‚¬μš©μž λ„€μž„μŠ€νŽ˜μ΄μŠ€ 내뢀에 있기 λ•Œλ¬Έμ— 크게 λ³΄μž…λ‹ˆλ‹€.

λ¬Όλ‘  그듀은 UIDμž…λ‹ˆλ‹€. μ£„μ†‘ν•©λ‹ˆλ‹€.

감사!

podman stop <container> λŠ” ν™œμ„± toolbox enter λ˜λŠ” podman run μ„Έμ…˜μ΄ μ—†λŠ” ν•œ ν™•μ‹€νžˆ μž‘λ™ν•©λ‹ˆλ‹€.

podman stop <container> λŠ” ν•΄λ‹Ή μ„Έμ…˜μ„ κ°•μ œ μ’…λ£Œν•  것이라고 μƒκ°ν•©λ‹ˆλ‹€.

μ§€κΈˆκΉŒμ§€ Toolboxλ₯Ό λ§Œλ“œλŠ” 두 가지 λ‹€λ₯Έ 방법을 생각할 수 μžˆμŠ΅λ‹ˆλ‹€.
μ»¨ν…Œμ΄λ„ˆλŠ” μžλ™μœΌλ‘œ μ°Έμ‘° μΉ΄μš΄νŠΈλ©λ‹ˆλ‹€.
λ§ˆμ§€λ§‰ toolbox enter λ˜λŠ” toolbox run μ„Έμ…˜ ν•œ 번 쀑지
μ’…λ£Œλ˜μ—ˆμŠ΅λ‹ˆλ‹€.

coreos/toolbox μ—μ„œ μ‚¬μš©ν•˜λŠ” 또 λ‹€λ₯Έ μ˜΅μ…˜μ€ podman exec μ—μ„œ toolbox enter podman exec λ₯Ό ν˜ΈμΆœν•  λ•Œλ§ˆλ‹€ podman stop λ₯Ό ν˜ΈμΆœν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€. podman stop λŠ” ν™œμ„± podman exec μ„Έμ…˜μ΄ μžˆλŠ” ν•œ 계속 μ‹€νŒ¨ν•˜μ§€λ§Œ λ§ˆμ§€λ§‰ μ„Έμ…˜μ΄ λλ‚˜λ©΄ μ»¨ν…Œμ΄λ„ˆκ°€ μ€‘μ§€λ©λ‹ˆλ‹€.

λ‹€λ₯Έ λŒ€μ•ˆλ³΄λ‹€ 덜 μ •κ΅ν•˜μ§€λ§Œ κ΅¬ν˜„ν•˜κΈ°κ°€ 더 κ°„λ‹¨ν•©λ‹ˆλ‹€.

@debarshiray μ»¨ν…Œμ΄λ„ˆλ₯Ό 쀑지할 수 없을 λ•Œ "였λ₯˜: μ»¨ν…Œμ΄λ„ˆμ— ν™œμ„± μ‹€ν–‰ μ„Έμ…˜μ΄ 있으며 정리λ₯Ό κ±°λΆ€ν•©λ‹ˆλ‹€: μ»¨ν…Œμ΄λ„ˆ μƒνƒœκ°€ λΆ€μ μ ˆν•¨" 좜λ ₯을 μ–΅μ œν•˜λŠ” ν•œ κ°„λ‹¨ν•œ μ ‘κ·Ό 방식(μ‹€ν–‰ ν›„ 항상 쀑지)에 νˆ¬ν‘œν•˜κ² μŠ΅λ‹ˆλ‹€. .

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰