哪个是Dockerfile编码?

定义我的Dockerfile我得到了这一行:

...
MAINTAINER Ramón <ramon@example.com>
...

我应该使用哪种编码来保存此文件?

我应该转义非ASCII字符吗?

最佳答案 考虑到
Docker
Go
Go has native support for utf-8完成,最好保存直接用UTF-8编码的Dockerfile.

这样,支持所有字符(ASCII或非ASCII).

见“Dealing with encodings in Go”.

Even though Go has good support for UTF-8 (and minimal support for UTF-16), it has no built-in support for any other encoding.
If you have to use other encodings (e.g. when dealing with user input), you have to use third party packages, like for example 07004.

在这里,最好将Dockerfile直接编码为UTF-8.

2016年7月更新,docker 1.12-rc5增加:

> PR 23372:支持parseWords中的unicode字符
> PR 23234:从Dockerfile和.dockerignore跳过UTF-8 BOM字节(如果存在)

点赞