sh 适用于Mac的Docker的屏幕命令(防止重新连接时出现乱码)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 适用于Mac的Docker的屏幕命令(防止重新连接时出现乱码)相关的知识,希望对你有一定的参考价值。

# connect to tty on Docker for Mac VM
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty

# disconnect that session but leave it open in background
Ctrl-a d

# list that session that's still running in background
screen -ls

# reconnect to that session (don't open a new one, that won't work and 2nd tty will give you garbled screen)
screen -r

# kill this session (window) and exit
Ctrl-a k

# other option to connect w/o screen
docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
# Phil Estes says this does:
# it’s running a container (using the debian image..nothing special about it other than it apparently has `nsenter` installed)
# , with pid=host (so you are in the process space of the mini VM running Docker4Mac), and then nsenter says “whatever is pid 1, 
# use that as context, and enter all the namespaces of that, and run a shell there"

# from Justin Cormack
# Personally I mostly use screen, but then I also use 
docker run --privileged --pid=host justincormack/nsenter1
# too. That's my minimal nsenter image

以上是关于sh 适用于Mac的Docker的屏幕命令(防止重新连接时出现乱码)的主要内容,如果未能解决你的问题,请参考以下文章

sh 适用于Mac OS 10.11.5的代理自动启动/自动配置shell脚本

sh 适用于Mac的gitの特定コミット间の差分をzipで出力するやつ

MSSQL-Server On Docker

Docker镜像加速

Laravel 新命令不再适用于 MAC

适用于 Windows 的 Mac 风格“Dvorak - Qwerty 命令”键盘映射?