How to resolve 'missing : in substitution' when building docker image
1. The purpose of this post
Sometimes, when you build a Docker image, you might encounter the following error:
2. Environments
- Docker 18.09
3. The Dockerfile
Here is the Dockerfile that causes the problem:
4. The solution
The issue arises because Docker does not support the use of .
in environment variable names. To resolve this, replace .
with _
in the Dockerfile, as shown below:
After making this change, rebuild the Docker image, and the error should no longer occur.
5. Summary
In this post, we explored how to resolve the “missing : in substitution” error when building a Docker image. The key takeaway is to avoid using .
in environment variable names within the Dockerfile. Instead, replace .
with _
to ensure compatibility with Docker’s syntax rules. By following this simple adjustment, you can successfully build your Docker image without encountering this error.
Final Words + More Resources
My intention with this article was to help others who might be considering solving such a problem. So I hope that’s been the case here. If you still have any questions, don’t hesitate to ask me by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!