Tag: bash

Accessing the number of arguments pass into a docker run command script

I have a docker Entrypoint script that looks like this: #!/bin/sh LABEL=$1 mkdir -p /backup/$LABEL … I can access the arguments passed in the normal bash way via $1, $2, etc. but I also need to know the number of arguments passed in. At first I thought I could do this like this: if [ […]

TCP, UDP and HTTP servers inside docker stop immediately after starting the container?

I am to host TCP, UDP and HTTP servers, developed by Java, inside a java docker container. All what I have in the dockerfile is a copy command for the server application and the bash files, which used to run the server/s. However, the servers are stopped some seconds after running the container? I use […]

Prevent request too quickly in bash

I have to enable, start, stop and restart docker in a bash script. The problem is that the command’s are executed with an ssh-connection. So after executing the command the ssh-connection closes. So there is not enough time to start and stop docker. I get this error: start request repeated too quickly for docker.service How […]

Docker bash'ing with find

I am having a hell of a time attempting to get a bash script to work as expected (as it does in a normal bash session) on a Docker run. The goal is to replace all of the symlinked files within the official java container with their actual file within the JAVA_HOME directory, so everything […]

Scripting Docker, Not Connected After Running Script?

So I have a script that looks like this: #!/bin/bash if [ $1 ]; then docker-machine start $1 docker-machine env $1 eval $(docker-machine env $1) docker ps -a fi Once it has run though, the scope of these commands seem to be over. For instance I don’t have a connection to the docker-machine once the […]

How to substitute variable value in “docker run” command

I am using a bash script and trying to assign a fingerprint value as below export FINGERPRINT=D0:19:C5:80:42:66:56:AC:6F docker run –rm -i -v /var/run/docker.sock:/var/run/docker.sock –name ucp docker/ucp join –replica –fingerprint $FINGERPRINT However, bash is not at all substituting the value of $FINGERPRINT

Setting up Text editor like Vim,Spacemacs to work with docker containers without installing tools on the host machine

I am trying to set up a modular development environment with docker containers, In which: 1) no sdks/dev tools/compilers getting installed in my host machine (those should live inside the specific containers only) 2) Using my text editors (Vim, Spacemacs) in their GUI version on OSX The main problem here is that most of the […]

Setting $PATH in docker image?

I’m creating a base image for my projects. In this base image, I will download a few .tar.gzs and extract them. I want to add these unzipped directories to be added to the path, so in child images, I can call up the downloaded executables directly without needing to specify the full path. I tried […]

Bash unable to create directory

In docker, I want to copy a file README.md from an existing directory /opt/ibm/labfiles to a new one /input/tmp. I try this hdfs dfs -put /opt/ibm/labfiles/README.md input/tmp to no effect, because there seems to be no /input folder in the root. So I try to create it: hdfs dfs -mkdir /input mkdir:’/input’: File exists However, […]

Trying to run Cloudera Image in Docker

I am trying to run cloudera/clusterdock in a docker image for a university project. This is my first time using docker and so far I have been using the instructions on the cloudera website which are a little sparse. I successfully downloaded docker and the cloudera image and when I run the docker-images command I […]

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