All Questions
48
questions
0
votes
0
answers
67
views
docker compose down service with label
I'm trying to figure out how to programmatically compose down several services with a label.
Currently I'm just using docker container stop as such: docker container stop -t 60 $(docker ps -q -f "...
1
vote
0
answers
92
views
ls in Docker on Windows not showing one directory
I'm running Windows Server 2016 Datacenter version 1607 (build 14393.6614) with Docker Desktop Community Version 2.0.0.3 (31259).
I'm running an Ubuntu docker container in an interactive mode with my ...
2
votes
0
answers
56
views
Setting GitHub Actions Secrets on Docker container build/run command, but encountering a parsing issue
I'm in the early stages of building an automated pipeline. Still in the exploring phase. Right now, I'm struggling with setting the environment variables for the container I'm going to run my app.
The ...
0
votes
1
answer
454
views
docker login fails when done in .bashrc
At the end of my .bashrc file I have the following:
docker login -u AWS -p $(aws --region us-east-2 ecr get-login-password) 636602586062.dkr.ecr.us-east-2.amazonaws.com
However, whenever I open up a ...
0
votes
0
answers
2k
views
How to solve exec format error while running container in ECS?
Previously the question was related to https://stackoverflow.com/questions/77266768/yarn-command-not-found-after-successful-docker-build. It was fixed but my problem is related to using shell /bin/sh.
...
0
votes
0
answers
200
views
Integrate aws-cli via docker to the linux command line
In order not to have too many local installations, I decided to encapsulate the aws and kubectl cli's to a docker container and integrate it via this script, which is accessible on the path:
#!/bin/...
0
votes
0
answers
130
views
Is there a way to restrict a linux user in a Dockerfile to only be allowed to run some specific commands?
I'm creating a Dockerfile with Fedora as base image. I created an user and I want this user to only be allowed to run basic commands (touch, echo, git).
I already tried modifying the sudoers file and ...
2
votes
2
answers
5k
views
"ERROR: cannot copy to non-directory" when copying to WORKDIR?
I am simply trying to copy all the contents of the current directory into the docker image. Why is the WORKDIR not allowed as a destination?
from ubuntu:20.04
WORKDIR .
ENV TZ=America/Los_Angeles
RUN ...
1
vote
1
answer
30
views
An image shows up again upon re-creation even after 'docker image ls' shows an empty result?
We have one existing docker image:
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
setupython latest 3ce7423c6076 11 hours ago 1.49GB
Let's write a utility to ...
0
votes
1
answer
962
views
Why is a stopped docker container not showing in 'docker ps'?
I tried to remove a docker image but was told it is used by a stopped container:
docker image rm 7bf111746926
Error response from daemon: conflict: unable to delete 7bf111746926 (must be forced) - ...
0
votes
1
answer
3k
views
How can I create a symbolic link of a file in another directory with relative path?
THE PROBLEM
I'm developping an ai training app. The app uses docker and some folders are shared (mounted). Absolute paths inside and outside docker differ, and I need to create symlinks that work on ...
0
votes
0
answers
2k
views
null, message from server: Host '172.17.0.1' is not allowed to connect to this MySQL server
I am on Acer Aspire 5738 with 8GB ram, swap 16GB installed with Pop!_OS. I am using DBeaver as a RDBMS client and have created 3 containers and 3 separate volumes (to persist data) for 3 database ...
0
votes
1
answer
6k
views
Load ENV file from bash script
I have a bash script that has the following content :
#!/bin/bash
source ./django.dev.env
docker compose --env-file ./uvicorn.dev.env -f ./docker-compose.yaml
and a django.dev.env file with the ...
1
vote
1
answer
2k
views
How to make apache service run continuously from script file from docker?
I am trying to run apache2 service from .sh script from dockerfile. The 'sh' script contains 3 executable commands which is presented as below:
#!/bin/bash
export DISPLAY=:0.0
echo "pvw ...
0
votes
0
answers
855
views
How do I convert a linux iso into docker image/container
I am trying to convert a linux distro(RasPBX) into a docker container. So, far I was able to deploy the container, its runs without the desired outcome. Here is the docker file and dockerignore file:
...
1
vote
0
answers
233
views
Shell Script With Proper Permissions Gets "Not Found" When Attempting to Run
I have a weird situation going on. I have created an Ubuntu-based Docker container and copied in a bash shell script that will be used in that container. I can go into the CLI for the container and ...
-1
votes
1
answer
954
views
How to run exec command in a loop until it is successful
I want run exec $Docker-run command until it's successful on redhat linux. Looping over it?
$Docker-run = docker run --env-file .env Image-name
Can anyone provide a solution?
0
votes
1
answer
1k
views
Get absolute path on host for container PID's executable
Context:
CentOS 7 host
Ubuntu container
Dockerfile:
FROM ubuntu
ENTRYPOINT ["/bin/bash"]
Observation:
Building and running the above container, a new bash process will be launched on the ...
1
vote
1
answer
3k
views
Passing variables to docker run from within a bash shell, getting "unterminated quoted string" error
I have a bash shell with multiple variables that form the command options of a docker run command. I suspect a < character is breaking the config line that I am passing.
This is the command that I ...
0
votes
1
answer
58
views
shellcheck vs. Docker
Until now I used to stop all running Docker containers like this:
docker stop $(docker ps -q)
Now that I've used shellcheck, it told me this:
Quote this to prevent word splitting.shellcheck(SC2046)
...
2
votes
2
answers
5k
views
Docker exec with dollar variable
I'm trying to run a command inside a Docker container with an environment variable, but I can't figure out the right syntax.
I can see the variable is set correctly:
$ docker exec -e FOO=bar ...
0
votes
1
answer
713
views
Issue parsing variable into curl to send JSON to splunk
I have a simple script here that I intend to run periodically:
statsout=`docker stats --no-stream --format "{{json .}}"`
while read line ; do
echo "$line"
curl -k &...
0
votes
1
answer
1k
views
Start a Docker container via SSH and kill it on exit (by trapping Ctrl-C)
I'd like to start a Docker container remotely via SSH and, once exiting the SSH command with Ctrl-C, stop the Docker container.
So far I have this:
#!/usr/bin/env bash
set -e
docker run --rm alpine ...
0
votes
1
answer
36
views
can't get ssh running on docker via dockerfile
Here's my Dockerfile:
FROM php:7.4
RUN apt-get install -y openssh-server \
&& useradd --create-home --base-dir /home myuser \
&& echo "myuser:myuser" | chpasswd \
...
0
votes
1
answer
166
views
Bash script behaves differently between local and remote execution
I got the following script to run pre-backup stuff on my server :
#!/bin/bash
dump_name="nextcloud_$(date +%d-%m-%y_%H-%M-%S)_backup.sql"
printf "Enabling maintenance mode... "
docker exec -u www-...
2
votes
0
answers
2k
views
Docker container entry points complain "cannot execute binary file: Exec format error"
I've been stumped trying to run Nextcloud via docker for the past few weeks. I've tried using ownyourbits/nextcloudpi, nextcloud, and the example docker-compose scripts provided by the Nextcloud team, ...
3
votes
1
answer
1k
views
Grafana Docker entrypoint script stops with "No such file or directory", but file is there
I'm trying to run Grafana on my Raspberry Pi 3 with docker. My docker-compose entry for it is pretty straightforward:
version: '3.7'
services:
grafana:
container_name: grafana
image: ...
3
votes
2
answers
1k
views
Docker : how to launch a script on host when container stops?
I would like to know if it is possible to launch bash script on host when a docker container is stopped.
For example I would like to stop a service when my container is stopped.
I saw that catching ...
1
vote
1
answer
5k
views
Docker on Raspberry Pi. 'docker-ce' has no installation candidate
I tried to install Docker on my Raspberry Pi (Raspbian GNU/Linux 10). Most websites show that it can be done in just one or two command lines.
curl -sSL https://get.docker.com | sh
or
curl -fsSL get....
6
votes
3
answers
12k
views
Connection refused using host.docker.internal in docker container
I have a localhost:8000 open on the host machine. Specifically:
$ php -S localhost:8000
PHP 7.1.19 Development Server started at Tue Jul 16 09:49:08 2019
Listening on http://localhost:8000
I can ...
0
votes
1
answer
1k
views
Deleted /usr/bin/docker on CentOs
I wanted to uninstall docker from my CentOs Machine and run this script :
curl -sSL https://get.docker.com/ | sh
But it told me that the docker command was already available on the system and it ...
4
votes
3
answers
2k
views
Script run with shebang does not resolve aliases, how to circumvent?
My main shell is zsh.
I am using Docker for Windows and therefore docker inside WSL is not found, because the call should be to docker.exe.
A quick hack I found online was to alias docker=docker.exe,...
2
votes
0
answers
7k
views
ping: : Name or service not known - while pinging a valid ip
Well, This appears to be a known issue to many but I've applied many of the workarounds I found online but none of them worked!
I'm running packer from a docker container to build an image on ...
16
votes
1
answer
45k
views
"volumes 'type' is a required property" when running docker-compose
I am working through understanding how docker-compose.yaml works. I am trying to define a volume inside the compose file and to mount it at a mount point locally. I try to run a basic .yaml to mount ...
0
votes
1
answer
7k
views
Run multiple jar files sequentially (not simultaneously) using shell script and docker
I have 2 jar files say abc.jar and xyz.jar , I want to run them sequentially one after another.
when my start.sh is like this
/usr/lib/jvm/java-8-openjdk-amd64/bin/java -jar abc.jar &
/usr/lib/...
0
votes
1
answer
76
views
Bash script for Docker container in Windows returns "Unknown target"
I've downloaded a repository that contains a .sh script to open a Docker container. I'm running Windows 10 with Docker Toolbox (rather than the full version, which has some Hyper-V issues) and its ...
0
votes
1
answer
2k
views
How to copy environment variables from local shell to a remote ssh connection inside a shellscript?
I am currently working on a shell script that is used to build docker images and restart containers running on the remote host. below is the stripped down version of the code.
#!/bin/bash -xe
# ...
1
vote
1
answer
732
views
IF block statement in inside an execlineb script
I have a Docker Container based on Alpine which runs S6 Overlay to manage two services inside it (a music DB, and a web interface to manage it). The problem is that the second service is optional, and ...
2
votes
1
answer
146
views
How to effect side effects in pipe
I'm running minikube as a local test environment and using docker multi-stage builds to build my containers. Minikube runs a version of docker that doesn't support multi-stage builds. Minikube ...
4
votes
2
answers
4k
views
With docker is there a way of determining what images rely on another image
With docker I can identify all named and tagged containers with docker images which lists them out.
I can find out what other images a given image relies on using docker inspect --format '{{.RootFS....
2
votes
1
answer
4k
views
Compressor detection issue when running curl command from bash script in Docker container
I want to execute curl using bash script inside the Docker container.
This is my script file script.sh that I added to the container:
curl -X POST http://localhost:9200/tests/test -d usr/share/...
6
votes
2
answers
5k
views
syntax error near unexpected token `(' writing bash function
I have
testapi() { docker-compose -f /home/me/projects/api/docker-compose.yml run -e "API_BRANCH=${1-master}" --rm api_test ;}
It causes error:
$ src
bash: /home/me/.bash_profile: line 56: syntax ...
10
votes
5
answers
13k
views
Docker exec doesn't load aliases
I have a bash alias loaded into a Docker container, in /etc/bash.bashrc.
It functions as a shortcut to a commandline PHP script.
This is convenient, since anyone can use that alias directly after one ...
9
votes
5
answers
7k
views
Docker on Conemu
I am trying to make docker run on ConEmu by creating a task that open up Docker start.sh file usinggit bash.
Since normally docker Terminal is pointing to "C:\Program Files\Git\bin\bash.exe" --login ...
8
votes
4
answers
29k
views
Redirecting command output in docker
I want to do some simple logging for my server which is a small Flask app running in a Docker container.
Here is the Dockerfile
# Dockerfile
FROM dreen/flask
MAINTAINER dreen
WORKDIR /srv
# Get ...
0
votes
1
answer
3k
views
Docker Quickstart Terminal: cd: /u: Permission denied
I've just installed Docker for Windows.
Quickstart terminal creates the 'default' vm, but then it can't access it with text:
bash: cd: /u: Permission denied
Looks like something went wrong... Press ...
11
votes
2
answers
10k
views
Mounting a directory from the host in boot2docker for Windows
I'm running docker 1.6 and boot2docker on a Windows 8.1 box. When I use the Boot2Docker Start shortcut, it takes me to a cygwin bash prompt where I can run docker commands natively.
I'm having ...
3
votes
0
answers
278
views
Enter a Failed Docker Container with a Different Command
I have a fairly complicated docker container I'm attempting to build. As part of the build process I have I install Chef and have Chef install a number of cookbooks using Chef-Solo. I am having the ...