docker / docker/docker-py

Interpreter: No such file or directory

Open
#2,149 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/question
Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

I'm getting [FATAL tini (6)] exec /bin/bash -c 'echo hello world' failed: No such file or directory any idea?
There isn't a CRLF problem, all files alrready are on LF (I use dos2unix on all files to make certain), already try /usr/bin/env bash and /bin/sh.

dockerfile


FROM ubuntu:xenial

# Update then install needed programs
RUN apt-get -qq -y update && \
  apt-get -qq -y upgrade && \
  apt-get -qq -y install \
  software-properties-common build-essential patch \
  git make gcc tree zlib1g-dev wget

# Instaling Hyperfine
RUN wget https://github.com/sharkdp/hyperfine/releases/download/v1.2.0/hyperfine_1.2.0_amd64.deb \
    && dpkg -i hyperfine_1.2.0_amd64.deb \
    && rm hyperfine_1.2.0_amd64.deb

# Install Hugo
RUN wget https://github.com/gohugoio/hugo/releases/download/v0.48/hugo_0.48_Linux-64bit.deb \
    && dpkg -i hugo_0.48_Linux-64bit.deb \
	&& rm hugo_0.48_Linux-64bit.deb

# Generator Dir
RUN mkdir /opt/hugo
COPY . /opt/hugo/
WORKDIR /opt/hugo

# Clean instal
RUN apt-get -qq -y clean && \
    apt-get -qq -y purge && \
    apt-get -qq -y --purge autoremove && \
    rm -rf /var/lib/apt/lists/*

Program.py


self.server = docker.DockerClient(base_url=self.benchmarker.config.server_docker_host)

def run(self, test, run_log_dir):
        """
        Run the given Docker container(s)
        """

        log_prefix = "%s: " % test.name
        container = None

        try:

            def watch_container(docker_container, docker_file):
                with open(os.path.join(run_log_dir, "%s.log" % docker_file.replace(
                        ".dockerfile", "").lower()), 'w') as run_log:
                    for line in docker_container.logs(stream=True):
                        log(line, prefix=log_prefix, file=run_log)

            extra_hosts = None
            name = "ssgberk-server"

            if self.benchmarker.config.network is None:
                extra_hosts = {
                    socket.gethostname():
                    str(self.benchmarker.config.server_host),
                    'ssgberk-server':
                    str(self.benchmarker.config.server_host),
                }
                name = None

            sysctl = {'net.core.somaxconn': 65535}

            ulimit = [{
                'name': 'nofile',
                'hard': 200000,
                'soft': 200000
            }, {
                'name': 'rtprio',
                'hard': 99,
                'soft': 99
            }]

            commands = ["/bin/bash -c 'echo hello world'", "/usr/bin/env bash -c 'chmod a+x build.sh'", "/usr/bin/env bash -c './build.sh'"]
            #commands = ["bash -c 'ls -l'", "ls /usr/bin/", "ls /bin"]

            container = self.server.containers.run(
                "matheusrv/ssgberk.test.%s" % test.name,
                command=list(commands),
                name=name,
                network=self.benchmarker.config.network,
                network_mode=self.benchmarker.config.network_mode,
                stderr=True,
                detach=True,
                init=True,
                extra_hosts=extra_hosts,
                privileged=True,
                ulimits=ulimit,
                sysctls=sysctl,
                remove=True,
                log_config={'type': None})

            watch_thread = Thread(
                target=watch_container,
                args=(
                    container,
                    "%s.dockerfile" % test.name,
                ))

            watch_thread.daemon = True
            watch_thread.start()


            #with open(os.path.join(run_log_dir, "%s.log" % test.name.lower()), 'w') as run_log:
            #    print(test.name)
            #    call(["/bin/bash docker"],shell=True)

        except Exception:
            with open(os.path.join(run_log_dir, "%s.log" % test.name.lower()), 'w') as run_log:
                tb = traceback.format_exc()
                log("Running docker cointainer: %s.dockerfile failed" %
                    test.name,
                    prefix=log_prefix,
                    file=run_log)
                log(tb, prefix=log_prefix, file=run_log)

        return container

versions

(bash on windows) $ uname -a
Linux DESKTOP-TKI46T0 4.4.0-17134-Microsoft #285-Microsoft Thu Aug 30 17:31:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux

(vagrant) $ uname -a
Linux SSGBERK-all 4.4.0-135-generic #161-Ubuntu SMP Mon Aug 27 10:45:01 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

(vagrant) $ docker -v
Docker version 18.06.1-ce, build e68fc7a

(vagrant) $python3 -v
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux

(vagrant)
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:24:56 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:23:21 2018
  OS/Arch:          linux/amd64
  Experimental:     false

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Program.py at the commands list and the containers.run call, especially how command=list(commands) is passed to the Docker container. Reproduce the reported error with the supplied Dockerfile and version details, then inspect the container logs. Done means the command execution behavior is explained and a reproducible fix or limitation is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.