両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン |
linux:podman [2025/03/29 09:01] – [コンテナ実行 [run]] ともやん | linux:podman [2025/03/31 06:43] (現在) – [参考文献] ともやん |
---|
</pre></html></WRAP> | </pre></html></WRAP> |
</WRAP> | </WRAP> |
| |
| === コンテナを実行しシェルに入るには...🤔 [-i, --interactive] === |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> fedora <font color="#A347BA">--rm</font> <font color="#A347BA">-ti</font> tomoyan596/fedora41-minimal-zsh zsh |
| </pre></html></WRAP> |
| Or |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> fedora <font color="#A347BA">--rm</font> <font color="#A347BA">--tty</font> <font color="#A347BA">--interactive</font> tomoyan596/fedora41-minimal-zsh |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| <font color="#5F00FF">┌──(</font><font color="#F66151"><b>root 💀 23b4e150d685</b></font><font color="#5F00FF">)-[</font><b>~</b><font color="#5F00FF">]</font> |
| <font color="#5F00FF">└─</font><font color="#F66151"><b>#</b></font> |
| </pre></html></WRAP> |
| </WRAP> |
| |
| === コンテナ内のカラーが微妙に違う...🤔ドウデモイイケドネ...😅 === |
| 気になる人のために...😉\\ |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269">buildah</font> u<font color="#999999">nshare</font> |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre class=BSc> |
| <font color="#5F00FF">┌──(</font><font color="#F66151"><b>root 💀 highway-x</b></font><font color="#5F00FF">)-[</font><b>~/</b><font color="#5F00FF">]</font> |
| <font color="#5F00FF">└─</font><font color="#F66151"><b>#</b></font> <font color="#26A269">exit</font> |
| </pre></html></WRAP> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> fedora <font color="#A347BA">--rm</font> <font color="#A347BA">-ti</font> tomoyan596/fedora41-minimal-zsh zsh |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre class=BSc> |
| ┌──(<font color="#F66151"><b>root 💀 dedcd1106d29</b></font>)-[<b>~</b>] |
| └─<font color="#F66151"><b>#</b></font> <font color="#26A269">exit</font> |
| </pre></html></WRAP> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> fedora <font color="#A347BA">--rm</font> <font color="#A347BA">-ti</font> <font color="#A347BA">-e</font> <font color="#A2734C">"TERM=$TERM"</font> tomoyan596/fedora41-minimal-zsh zsh |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre class=BSc> |
| <font color="#5F00FF">┌──(</font><font color="#F66151"><b>root 💀 d6d67305079a</b></font><font color="#5F00FF">)-[</font><b>~</b><font color="#5F00FF">]</font> |
| <font color="#5F00FF">└─</font><font color="#F66151"><b>#</b></font> |
| </pre></html></WRAP> |
| Or |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> fedora <font color="#A347BA">--rm</font> <font color="#A347BA">-ti</font> <font color="#A347BA">-e</font> <font color="#A2734C">"TERM=xterm-256color"</font> tomoyan596/fedora41-minimal-zsh zsh |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre class=BSc> |
| <font color="#5F00FF">┌──(</font><font color="#F66151"><b>root 💀 d6d67305079a</b></font><font color="#5F00FF">)-[</font><b>~</b><font color="#5F00FF">]</font> |
| <font color="#5F00FF">└─</font><font color="#F66151"><b>#</b></font> |
| </pre></html></WRAP> |
| </WRAP> |
| ※''$TERM'' 環境変数は通常 VTE によって設定されるが、''podman run'' または ''podman exec'' では今のところ設定されない🤔\\ |
| |
| ''$LS_COLORS'' は特に差異は認められない😊\\ |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269">icdiff</font> <font color="#A347BA"><</font><font color="#2A7BDE"><b>(</b></font><font color="#26A269">echo</font> $LS_COLORS<font color="#2A7BDE"><b>)</b></font> <font color="#A347BA"><</font><font color="#2A7BDE"><b>(</b></font><font color="#26A269">podman</font> run <font color="#A347BA">--name</font> fedora <font color="#A347BA">--rm</font> tomoyan596/fedora41-minimal-zsh echo $LS_COLORS<font color="#2A7BDE"><b>)</b></font> |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| <font color="#12488B">/proc/self/fd/11</font> <font color="#12488B">/proc/self/fd/12</font> |
| </pre></html></WRAP> |
| </WRAP> |
| |
| 一先ず ''-e "TERM=$TERM"'' で運用😅\\ |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> openwrt_builder <font color="#A347BA">--rm</font> <font color="#A347BA">-ti</font> <font color="#A347BA">-v</font> <font color="#2A7BDE"><b>`</b></font><font color="#26A269">pwd</font><font color="#2A7BDE"><b>`</b></font>/openwrt:/home/tomoyan/openwrt tomoyan596/openwrt_builder zsh |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre class=BSc> |
| ┌──(<b>tomoyan d72536ea41c9</b>)-[<b>~</b>] |
| └─<b>$</b> <font color="#26A269">exit</font> |
| </pre></html></WRAP> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font> run <font color="#A347BA">--name</font> openwrt_builder <font color="#A347BA">--rm</font> <font color="#A347BA">-ti</font> <font color="#A347BA">-v</font> <font color="#2A7BDE"><b>`</b></font><font color="#26A269">pwd</font><font color="#2A7BDE"><b>`</b></font>/openwrt:/home/tomoyan/openwrt <font color="#A347BA">-e</font> <font color="#A2734C">"TERM=</font><font color="#A347BA">$TERM</font><font color="#A2734C">"</font> tomoyan596/openwrt_builder zsh |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre class=BSc> |
| <font color="#00FFFF">┌──(</font><font color="#0087FF"><b>tomoyan f300a11c5dff</b></font><font color="#00FFFF">)-[</font><b>~</b><font color="#00FFFF">]</font> |
| <font color="#00FFFF">└─</font><font color="#0087FF"><b>$</b></font> |
| </pre></html></WRAP> |
| </WRAP> |
| |
| **参考文献:**\\ |
| [[https://www.baeldung.com/linux/docker-container-colored-bash-output|Displaying Colored Output in Bash Inside a Docker Container | Baeldung on Linux]]\\ |
| [[https://forums.docker.com/t/wrong-colors-inside-docker-container/68322|Wrong colors inside Docker container - General - Docker Community Forums]]\\ |
| [[https://www.howtogeek.com/307899/how-to-change-the-colors-of-directories-and-files-in-the-ls-command/|How to Change the Colors of Directories and Files in the ls Command]] [[gtr>https://www.howtogeek.com/307899/how-to-change-the-colors-of-directories-and-files-in-the-ls-command/|翻訳]]\\ |
| [[https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/|BASH Shell Change The Color of Shell Prompt on Linux or UNIX - nixCraft]]\\ |
| [[https://superuser.com/questions/841016/how-to-configure-gnome-terminal-to-use-xterm-256color-by-default|linux - How to configure gnome-terminal to use xterm-256color by default? - Super User]]\\ |
| [[https://askubuntu.com/questions/233280/gnome-terminal-reports-term-to-be-xterm/578798|Gnome-Terminal reports $TERM to be `xterm` - Ask Ubuntu]] [[gtr>https://askubuntu.com/questions/233280/gnome-terminal-reports-term-to-be-xterm/578798|翻訳]]\\ |
| |
=== 実行例 === | === 実行例 === |
[[https://www.redhat.com/sysadmin/speeding-container-buildah|Speeding up container image builds with Buildah | Enable Sysadmin]]\\ | [[https://www.redhat.com/sysadmin/speeding-container-buildah|Speeding up container image builds with Buildah | Enable Sysadmin]]\\ |
[[https://stackoverflow.com/questions/57776452/is-it-possible-to-map-a-user-inside-the-docker-container-to-an-outside-user|linux - Is it possible to map a user inside the docker container to an outside user? - Stack Overflow]]\\ | [[https://stackoverflow.com/questions/57776452/is-it-possible-to-map-a-user-inside-the-docker-container-to-an-outside-user|linux - Is it possible to map a user inside the docker container to an outside user? - Stack Overflow]]\\ |
| [[https://kinsta.com/blog/dockerfile-entrypoint/|Dockerfile ENTRYPOINT: Everything You Need To Know]]\\ |
| |
==== 付録 ==== | ==== 付録 ==== |