Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is #syntax=docker/dockerfile:experimental?

Tags:

dockerfile

I have been working with dockerfiles for a while now but today I was working on a small project and somehow on my VScode I typed # then CTRL+SPACE on the first line I got this syntax=docker/dockerfile:experimental.

I don't understand what this does and can't find documentation about it can somebody explain what's with that weird comment.

PS I found some people using this so it's not just some random comment generated by vscode I guess.

like image 934
Affes Salem Avatar asked Dec 04 '25 14:12

Affes Salem


1 Answers

It's a way to enable new syntax in Dockerfiles when building with BuildKit. It's mentioned in the documentation:

Overriding default frontends

The new syntax features in Dockerfile are available if you override the default frontend. To override the default frontend, set the first line of the Dockerfile as a comment with a specific frontend image:

# syntax=<frontend image>, e.g. # syntax=docker/dockerfile:1.2

The examples on this page use features that are available in docker/dockerfile version 1.2.0 and up. We recommend using docker/dockerfile:1, which always points to the latest release of the version 1 syntax. BuildKit automatically checks for updates of the syntax before building, making sure you are using the most current version. Learn more about the syntax directive in the Dockerfile reference.

I have used it to enable SSH Auth Sock forwarding.

like image 164
Lars Nyström Avatar answered Dec 08 '25 16:12

Lars Nyström



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!