【Docker】docker exec 使用户名登陆容器报错
环境 :
macOS 10.12.6 (16G29)Docker version 17.06.0-ce, build 02c1d87
bash命令:docker-compose exec —user=laradock workspace bash
报错:
1 ↵Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose/cli/main.py", line 68, in main
File "compose/cli/main.py", line 118, in perform_command
File "compose/cli/main.py", line 401, in exec_command
File "compose/project.py", line 142, in get_service
File "compose/project.py", line 632, in __init__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
Failed to execute script docker-compose
使用:docker-compose exec workspace bash
能进入 . 但是是root权限
我想要非root权限登陆容器。
回答
docker run -u
有个 -u
获取能帮到你
看你报错应该是编码或者其他的问题,不是操作本身的问题
官方的【issue】
同样的错误,同问。我的解决方案是:docker-compose exec workspace bash 后 su user
最终解决方案:docker exec -it -u user 容器ID bash
以上是 【Docker】docker exec 使用户名登陆容器报错 的全部内容, 来源链接: utcz.com/a/79558.html