# Entrypoint Problems

**URL:** <https://forums.docker.com/t/entrypoint-problems/44724>\
**Category:** General\
**Created:** [January 18, 2018, 3:31pm UTC](https://forums.docker.com/t/entrypoint-problems/44724 "2018-01-18T15:31:48Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![additude](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/additude/32/18332_2.png) [@additude](https://forums.docker.com/u/additude)\
**Post date:** [January 18, 2018, 3:31pm UTC](https://forums.docker.com/t/entrypoint-problems/44724/1 "2018-01-18T15:31:48Z")

</div>

## I am having Entrypoint problems and I’m not sure what is happening. On my master-node I created a directory at /boinc/ and in that directory I have Dockerfile and boinc\_start.sh Dockerfile is basic:

FROM ubuntu:latest  
LABEL Maintainer="Me [odroid@odroid.com](mailto:odroid@odroid.com)"  
LABEL description=“Boinc3 MC1-2 image”

## Install BOINC

RUN apt-get update && apt-get install -y boinc-client && apt-get clean && rm -rf /var/lib/apt/lists/\*

## Set working directory

WORKDIR /var/lib/boinc-client

## Make port 80 available

EXPOSE 80

## Create an entry point

ENTRYPOINT /boinc/boinc\_start.sh

## Run BOINC by default. Expects env vars for url and account key

## CMD /etc/init.d/boinc-client start; sleep 5; /usr/bin/boinccmd --project\_attach ${boincurl} ${boinckey}; tail -f /var/lib/boinc-client/std\*.txt

## and boinc\_start.sh is:

## #!/bin/bash mkdir -p /dev/input/mice exec “$@”

I have chmod +x /boinc/boinc\_start.sh

## I build the file with:

## cd /boinc/ docker build -t additude/boinc3 .

image builds successfully

## I push the image:

## docker push additude/boinc3

## Then I go to a different node and I:

## cd / mkdir /boinc/ cd /boinc/ nano boinc\_start.sh #!/bin/bash mkdir -p /dev/input/mice exec "$@" nano write and save chmod +x /boinc/boinc\_start.sh mkdir /boinc/boinc\_persist

## then from the node, still in the /boinc/ directory

## docker run -it -d --name Seti-3 -h node2-2 -v /boinc/boinc\_persist:/var/lib/boinc-client --log-opt max-size=10m --log-opt max-file=3 --restart=always -e “[boincurl=setiathome.berkeley.edu](http://boincurl=setiathome.berkeley.edu)” -e “boinckey=xxxxxxxxxxxxxxxxx” additude/boinc3

Everything goes fine, pulls the image from additude/boinc3.

## I check the logs docker logs Seti-3 and:

## root@node2-2:/boinc# docker logs Seti-3 /bin/sh: 1: /bin/sh: /boinc/boinc\_start.sh: not found /bin/sh: 1: /bin/sh: /boinc/boinc\_start.sh: not found /bin/sh: 1: /bin/sh: /boinc/boinc\_start.sh: not found /bin/sh: 1: /bin/sh: /boinc/boinc\_start.sh: not found /bin/sh: 1: /bin/sh: /boinc/boinc\_start.sh: not found /bin/sh: 1: /bin/sh: /boinc/boinc\_start.sh: not found /bin/sh: 1: /bin/sh: /boinc/boinc\_start.sh: not found /bin/sh: 1: /bin/sh: /boinc/boinc\_start.sh: not found /bin/sh: 1: /bin/sh: /boinc/boinc\_start.sh: not found

I am out of ideas at this point. I have tried several things and read and read.  
I can’t make it work. I need some help.  
Thanks.

---

<div class="post-metadata">

**Author:** ![sdetweil](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@sdetweil](https://forums.docker.com/u/sdetweil)\
**Post date:** [January 18, 2018, 4:00pm UTC](https://forums.docker.com/t/entrypoint-problems/44724/2 "2018-01-18T16:00:47Z")

</div>

but… boinc\_start.sh is not IN the container or accessible by the container

```auto
Then I go to a different node and I:
cd /
mkdir /boinc/ <---- that is on the host
cd /boinc/
nano boinc_start.sh <--- this is on the host
#!/bin/bash
mkdir -p /dev/input/mice
exec "$@"
nano write and save
chmod +x /boinc/boinc_start.sh
mkdir /boinc/boinc_persist

```

you shared boinc\_persist with the container

```auto
-v /boinc/boinc_persist:/var/lib/boinc-client

```

but not boinc itself.

and /boinc doesn’t exist IN the container…  
you didn’t create it in the Dockerfile  
and didn’t map it from the host into the container on docker run

---

<div class="post-metadata">

**Author:** ![additude](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/additude/32/18332_2.png) [@additude](https://forums.docker.com/u/additude)\
**Post date:** [January 18, 2018, 4:07pm UTC](https://forums.docker.com/t/entrypoint-problems/44724/3 "2018-01-18T16:07:46Z")

</div>

Thanks,  
That all makes sense to me.  
But how do I successfully get boinc\_start.sh into the container where it can be found?

ADD or COPY in the Dockerfile?

maybe it should be located in a directory above where I do the docker build?

I can’t figure it out.

---

<div class="post-metadata">

**Author:** ![sdetweil](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@sdetweil](https://forums.docker.com/u/sdetweil)\
**Post date:** [January 18, 2018, 4:10pm UTC](https://forums.docker.com/t/entrypoint-problems/44724/4 "2018-01-18T16:10:40Z")

</div>

right…

create it on the host, in the same folder as the Dockerfile, make it executable  
then add this to the Dockerfile  
there are comment chars in front of the text below, don’t know hot fix this forums markup

# create the folder

run mkdir /boinc

# copy the command to the image

copy ./boinc\_start.sh /boinc

---

<div class="post-metadata">

**Author:** ![additude](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/additude/32/18332_2.png) [@additude](https://forums.docker.com/u/additude)\
**Post date:** [January 18, 2018, 4:12pm UTC](https://forums.docker.com/t/entrypoint-problems/44724/5 "2018-01-18T16:12:36Z")

</div>

Thanks. Every Example I looked at did not have this bit of info.

Is this something that needs to be done for every entrypoint file?

---

<div class="post-metadata">

**Author:** ![sdetweil](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@sdetweil](https://forums.docker.com/u/sdetweil)\
**Post date:** [January 18, 2018, 4:15pm UTC](https://forums.docker.com/t/entrypoint-problems/44724/6 "2018-01-18T16:15:13Z")

</div>

well, the files need to be INSIDE the container somewhere…

the doc shows how to get files in with add or copy commands.

the container is a closed environment, except for limited capabilities, -v or -e (environment) or parms beyond the image name.

---

<div class="post-metadata">

**Author:** ![additude](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/additude/32/18332_2.png) [@additude](https://forums.docker.com/u/additude)\
**Post date:** [January 18, 2018, 4:17pm UTC](https://forums.docker.com/t/entrypoint-problems/44724/7 "2018-01-18T16:17:38Z")

</div>

ok… I’m just looking too hard…

But I also tried in the Dockerfile:  
RUN mkdir /dev/input/mice

and that didn’t work… I thought it would…

---

<div class="post-metadata">

**Author:** ![sdetweil](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@sdetweil](https://forums.docker.com/u/sdetweil)\
**Post date:** [January 18, 2018, 4:19pm UTC](https://forums.docker.com/t/entrypoint-problems/44724/8 "2018-01-18T16:19:34Z")

</div>

> [@additude](#):
>
> /dev/input/mice

well /dev/ is a controlled folder… i don’t know that you can modify it

---

<div class="post-metadata">

**Author:** ![additude](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/additude/32/18332_2.png) [@additude](https://forums.docker.com/u/additude)\
**Post date:** [January 18, 2018, 4:23pm UTC](https://forums.docker.com/t/entrypoint-problems/44724/9 "2018-01-18T16:23:19Z")

</div>

after the container is running, when I don’t use the entrypoint file I can do docker exec mkdir -p /dev/input/mice and it creates the directory…

that’s why I felt RUN mkdir -p /dev/input/mice would work…

---

<div class="post-metadata">

**Author:** ![sdetweil](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@sdetweil](https://forums.docker.com/u/sdetweil)\
**Post date:** [January 18, 2018, 4:33pm UTC](https://forums.docker.com/t/entrypoint-problems/44724/10 "2018-01-18T16:33:20Z")

</div>

ok, i don’t ever fiddle with /dev, so I don’t know the rules

---

<div class="post-metadata">

**Author:** ![additude](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/additude/32/18332_2.png) [@additude](https://forums.docker.com/u/additude)\
**Post date:** [January 18, 2018, 4:34pm UTC](https://forums.docker.com/t/entrypoint-problems/44724/11 "2018-01-18T16:34:14Z")

</div>

Thanks for your help. !!

---

<div class="post-metadata">

**Author:** ![rajchaudhuri](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/rajchaudhuri/32/46403_2.png) [@rajchaudhuri](https://forums.docker.com/u/rajchaudhuri)\
**Post date:** [January 20, 2018, 8:16am UTC](https://forums.docker.com/t/entrypoint-problems/44724/12 "2018-01-20T08:16:58Z")

</div>

Has the problem been solved? If not, here is what you need to do.

First, create a directory from which you will build the docker image (lets call it /boinc). In this directory, ensure that there are two files: boinc\_start.sh and the Dockerfile. The contents of these files should be as follows:

boinc\_start.sh:

```
#!/bin/bash
mkdir -p /dev/input/mice
exec "$@"

```

Dockerfile:

```
FROM ubuntu:latest
LABEL Maintainer="Me odroid@odroid.com"
LABEL description=“Boinc3 MC1-2 image”

# Install BOINC
RUN apt-get update && apt-get install -y boinc-client && apt-get clean

# ADDED BY RAJ: Copy entrypoint shell script
COPY boinc_start.sh /boinc/boinc_start.sh

# ADDED BY RAJ: Make it executable
RUN chmod +x /boinc/boinc_start.sh

# Set working directory
WORKDIR /var/lib/boinc-client

# Make port 80 available
EXPOSE 80

# Create an entry point
ENTRYPOINT /boinc/boinc_start.sh

# Run BOINC by default. Expects env vars for url and account key
CMD /etc/init.d/boinc-client start; sleep 5; \
            /usr/bin/boinccmd --project_attach ${boincurl} ${boinckey}; \
            tail -f /var/lib/boinc-client/std*.txt

```

Note the additions I have made to your Dockerfile. These two commands will copy the boinc\_start.sh script into the image and make it executable, as part of building the image.

Now, build the image with:

```
cd /boinc
docker build -t additude/boinc3 .

```

And push it with:

```
docker push additude/boinc3

```

From this point on, you need only the image on any node. No need to create any directories or files, or anything else. Just create and run a container with:

```
docker run -it -d --name Seti-3 -h node2-2 
                  -e “boincurl=setiathome.berkeley.edu” 
                  -e “boinckey=xxxxxxxxxxxxxxxxx” 
                  additude/boinc3

```

If you want to persist the logs etc. beyond the lifetime of the container, use -v.

---

<div class="post-metadata">

**Author:** ![additude](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/additude/32/18332_2.png) [@additude](https://forums.docker.com/u/additude)\
**Post date:** [January 24, 2018, 4:15pm UTC](https://forums.docker.com/t/entrypoint-problems/44724/13 "2018-01-24T16:15:26Z")

</div>

Thanks. I have it working now !!
