Tag: bash

Docker passing in a variable into an shell script running git clone

I am creating a Dockerfile and as part of this file, I am wanting to give the end user the option to pass in their git repo. I looked at this SO post, and a few other sites but am stuck on the git clone syntax. The git clone command returns an error as the […]

Writing data to file in Dockerfile

I have a shell script, script.sh, that writes some lines to a file: #!/usr/bin/env bash printf “blah blah blah blah\n” | sudo tee file.txt Now in my Dockerfile, I add this script and run it, then attempt to add the generated file.txt: ADD script.sh . RUN chmod 755 script.sh && ./script.sh ADD file.txt . When […]

How to run nginx with docker container?

I tried to install nginx within my docker container, before the installation i want to run the docker run -i -t base /bin/bash command and but i got a error like this.. WARNING: Local (127.0.0.1) DNS resolver found in resolv.conf and containers can’t use it. Using default external servers : [8.8.8.8 8.8.4.4] [error] client.go:2298 Error […]

Why does “docker run” error with “no such file or directory”?

I am trying to run a container which runs an automated build. Here is the dockerfile: FROM ubuntu:14.04 MAINTAINER pmandayam # update dpkg repositories RUN apt-get update # install wget RUN apt-get install -y wget # get maven 3.2.2 RUN wget –no-verbose -O /tmp/apache-maven-3.2.2.tar.gz http://archive.apache.or g/dist/maven/maven-3/3.2.2/binaries/apache-maven-3.2.2-bin.tar.gz # verify checksum RUN echo “87e5cc81bc4ab9b83986b3e77e6b3095 /tmp/apache-maven-3.2.2.tar.gz” | md5 […]

How to detect fully interactive shell in bash from docker?

I’m wanting to detect in “docker run” whether -ti has been passed to the entrypoint script. docker run –help for -t -i -i, –interactive=false Keep STDIN open even if not attached -t, –tty=false Allocate a pseudo-TTY I have tried the following but even when tested locally (not inside docker) it didn’t work and printed out […]

How to execute the Entrypoint of a Docker images at each “exec” command?

After trying to test Dockerfiles with Dockerspec, I finally had an issue I can’t resolve properly. The problem is, I think, from Docker itself ; If I understand its process, an Entrypoint is only executed at run, but if the container stay started and I launch an “exec” command in, it’s not re-called. I think […]

How to check docker instance is running in Bash

Having docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 56489a32cb8c 83132b61eccf “bash” 41 hours ago Exited (0) 41 hours ago naughty_jang 4b4933b40175 83119b65eccf “bash” 41 hours ago Exited (0) 41 hours ago suspicious_mcnulty 3149e612f9f8 83119b6143cf “sh” 43 hours ago Exited (0) 41 hours ago thirsty_mestorf I want to match the STATUS and […]

Kubernetes – kubectl exec bash – session drop and line width

I’m having k8s cluster with 3 minions, master and haproxy in front. When I use kubectl exec -p $POD -i -t — bash -il for accessing bash in the pod (it is a single container in this case) I get in and after something like 5 mins I get dropped out of the terminal. If […]

Docker Run and variable substitution

I have a variable in a script called image_name image_name=”my-app” And I am attempting to pass this variable to a docker container as seen below: docker build -t $image_name . docker run –rm –name $image_name -e “app_dir=${image_name}” $image_name But this variable is not set and is blank within the context of the docker build This […]

Parsing a string to an array output from command line

I’m working on a new Symfony 2 project which will be a panel management for Docker containers. In this project, I’m executing some commands with the exec() PHP function. I’m trying to parse the output of the following command : docker create tutum/lamp:latest –name test 2>&1 When the command is a success I’m getting the […]

Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.