Tag: bash

Docker Check if DB is Running

entrypoint.sh contains various cqlsh commands that require Cassandra. Without something like script.sh, cqlsh commands fail because Cassandra doesn’t have enough time to start. When I execute the following locally, everything appears to work properly. However, when I run via Docker, script.sh never finishes. In other words, $status never changes from 1 to 0. Dockerfile FROM […]

Why does bash script work depend on the size of the terminal window?

I know this sounds strange, but here is the thing. I have a docker container, that hosts a database. And I have a script, that tries to execute a set a patches over it one by one. Now, the script does not know the database port (since each time the container binds to a different […]

DockerFile : how to get bash command line after start?

This question is not duplicated, because I want to obtain an interactive shell without running with -it flags. I’m moving first steps into Docker to create images only for internal use. I start from this envirornment_full.df: FROM ubuntu:16.04 ENTRYPOINT [“/bin/bash”] I then build docker rmi environment:full docker build -t environment:full -f environment.df . Then run […]

How can I remove all containers by image name and do nothing if it already removed

I have bash script which stops and remove all docker container by image name. I can stop and remove all docker container by image name by single command docker rm $(docker stop $( docker ps -a -q –filter ancestor=image_name)) But if container not exist this expression docker ps -a -q –filter ancestor=image_name not returns nothing […]

kali linux docker image build script failed – syntax error near unexpected token `;&' [closed]

According to the official site: official-kali-linux-docker-images #!/bin/bash # Install dependencies (debbootstrap) sudo apt-get install debootstrap # Fetch the latest Kali debootstrap script from git curl “http://git.kali.org/gitweb/?p=packages/debootstrap.git;a=blob_plain;f=scripts/kali;hb=HEAD” > kali-debootstrap &&\ sudo debootstrap kali ./kali-root http://http.kali.org/kali ./kali-debootstrap &&\ # Import the Kali image into Docker sudo tar -C kali-root -c . | sudo docker import – kalilinux/kali […]

Dockerfile – How to pass an answer to a prompt post apt-get install?

In my Dockerfile, I am trying to install jackd2 package: RUN apt-get install -y jackd2 It installs properly, but after installation, I can see the following prompt: If you want to run jackd with realtime priorities, the user starting jackd needs realtime permissions. Accept this option to create the file /etc/security/limits.d/audio.conf, granting realtime priority and […]

Syntax Error: Multiline bash command in dockerfile RUN statement

I have this Dockerfile, to which I am echoing the following line: echo $”RUN cat file | while read pkg \ do\ sudo apt-get install -qy $pkg \ done” >> Dockerfile Now, when docker executes this line, I get the following error: /bin/sh: -c: line 1: syntax error: unexpected end of file The command ‘/bin/sh […]

Docker shell 'ls -l' indenting newlines [duplicate]

This question already has an answer here: Missing Carriage Return in Docker for Mac Containers 3 answers

Unable to connect to Jupyter Notebook served by Docker

I’ve been learning Docker with the end goal of using it to serve up and share Jupyter Notebooks. Below is an example Dockerfile: FROM python:2 ENV PYTHONUNBUFFERRED 1 RUN pip install jupyter RUN useradd –create-home –home-dir /home/docker –shell /bin/bash docker RUN adduser docker sudo ADD start.sh /home/docker/start.sh RUN chmod +x /home/docker/start.sh RUN chown docker /home/docker/start.sh […]

Save docker state (edited postgresql.conf file for example)

I have downloaded a postgresql docker image and at the moment editing some config files. The problem that I have is that whenever I edit the config files and commit the docker image (save it as a new one), it never saves anything. The image is still the same as the one I downloaded. Image […]

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