4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Dockerの標準出力の改行コードはTTYオプションでCRLFになってしまう

Posted at

普通にrunするぶんには、改行コードはLFになる。

$ sudo docker run --rm ubuntu:14.04 echo "test" | cat -e
test$

ForegroundオプションのTTYを有効にすると、CRLFになってしまう・・・。

$ sudo docker run --rm -t ubuntu:14.04 echo "test" | cat -e
test^M$

runコマンドの出力結果をパイプして渡す、evalする場合などは-tオプションを外したほうがいいですね。

試したDockerのバージョン

$ sudo docker version
Client version: 1.6.0
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 4749651
OS/Arch (client): linux/amd64
Server version: 1.6.0
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 4749651
OS/Arch (server): linux/amd64
4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?