# Windows, .sh scripts, and the execute bit

**URL:** <https://forums.docker.com/t/windows-sh-scripts-and-the-execute-bit/12203>\
**Category:** Docker Desktop\
**Tags:** windows\
**Created:** [May 13, 2016, 8:56pm UTC](https://forums.docker.com/t/windows-sh-scripts-and-the-execute-bit/12203 "2016-05-13T20:56:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpratt71](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@dpratt71](https://forums.docker.com/u/dpratt71)\
**Post date:** [May 13, 2016, 8:56pm UTC](https://forums.docker.com/t/windows-sh-scripts-and-the-execute-bit/12203/1 "2016-05-13T20:56:30Z")

</div>

Since I think I’ve diagnosed my own problem, this is more of an FYI.

I tried to get this setup on Windows: [https://github.com/wurstmeister/kafka-docker](https://github.com/wurstmeister/kafka-docker)

It failed with errors until I added some commands to the dockerfile along the lines of “RUN chmod +x /usr/bin/start-kafka.sh”. I was confused about why this was necessary, but the answer eventually came to me: If the .sh files were being copied from a Linux system, the execute bit would presumably be already set. But on Windows, there is no such thing as an execute bit for a file.

I’m not sure what is the right answer here. I considered the possibility that docker proper should remove all attributes when copying files on the assumption that one shouldn’t rely on them being set. But I’m not sure that makes sense and even if it did, it’d probably break the world. I also considered that maybe Windows docker should set the execute bit for such files, but that didn’t entirely sit well with me either.

---

<div class="post-metadata">

**Author:** ![pcarrier](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/pcarrier/32/9994_2.png) [@pcarrier](https://forums.docker.com/u/pcarrier)\
**Post date:** [May 15, 2016, 10:47am UTC](https://forums.docker.com/t/windows-sh-scripts-and-the-execute-bit/12203/2 "2016-05-15T10:47:50Z")

</div>

This is a must have for some of our tooling and build toolchains.

Tarballs are produced and we check that we have the executable bit. It’d be better to always have the bit set, but what would be great would be to store that in attributes (even better if Cygwin and/or the os package in Golang would agree to the convention) as otherwise everything would be executable which happens to work for my very specific needs but isn’t exactly satisfying.

---

<div class="post-metadata">

**Author:** ![dockerklewis](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/dockerklewis/32/16662_2.png) [@dockerklewis](https://forums.docker.com/u/dockerklewis)\
**Post date:** [October 26, 2017, 10:06pm UTC](https://forums.docker.com/t/windows-sh-scripts-and-the-execute-bit/12203/3 "2017-10-26T22:06:48Z")

</div>

I too would like to know how we create and reference an `executable` script file, within a Dockerfile, if we are in Windows, using a terminal.
