devcontainers / devcontainers/cli

Building a Dockerfile appears to ignore escape directive

Open
#632 1 comment 0 reactions 1 assignee Claimed by @chrmarti View on GitHub
bug
Dominant language
TypeScript
Stars
3k
Forks
457
Avg merge
13h 17m
Merged PRs (30d)
6

Description

I'm on Windows and so prefer the escape character in a Dockerfile to be `` ` ``. Using the following Dockerfile errors with `ERROR: failed to solve: dockerfile parse error on line 8: unknown instruction: apt (did you mean add?):
apt (did you mean arg?)`:

```
# escape=`

FROM ubuntu:jammy as build

RUN set -eux; `
apt update;
```

I tried changing the Dockerfile to use LF instead of CRLF for end of lines but that didn't make a difference. Using the following did work, even with CRLF:

```
# escape=\

FROM ubuntu:jammy as build

RUN set -eux; \
apt update;
```
As well as:
```
FROM ubuntu:jammy as build

RUN set -eux; apt update;
```

All of the above Dockerfiles work with Docker CE on Windows. My `.devcontainer/devcontainer.json` is

```
{
"name": "foo",
"build": {
"context": "..",
"dockerfile": "../Dockerfile"
}
}
```
I'm using Dev Containers 0.304.0 in VS Code 1.82.0-insider (f1302be1e67e3af5fbeb8bbb2ea784de7bc96150)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.