简体   繁体   English

Docker 问题,如 ' | ' 在 Windows 10 Pro

[英]Docker problem with symbol like ' | ' in Windows 10 Pro

I'm using Docker for containers and Windows for development.我将 Docker 用于容器,将 Windows 用于开发。 I have a container with Ubuntu Linux on the container, I'm executing the command我在容器上有一个带有 Ubuntu Linux 的容器,我正在执行命令

docker exec -u 0 project-0 bash -c 'echo developer_1:test123 | chpasswd'

but windows thinking like I'm executing chpasswd , windows don't have that command and I have the error.但是 windows 认为我正在执行chpasswd , windows 没有该命令,我有错误。 How to fix it?如何解决?

I tried a lot of methods to beat this problem, but all unsuccessful.我尝试了很多方法来解决这个问题,但都没有成功。 Maybe something wrong with my command?也许我的命令有问题?

The escape character in CMD is ^ : CMD 中的转义字符是^

docker exec -u 0  project-0 bash -c 'echo developer_1:test123 ^| chpasswd'

Alternatively, you can use double quotes:或者,您可以使用双引号:

docker exec -u 0  project-0 bash -c "echo developer_1:test123 | chpasswd"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM