Prompt
stringlengths
14
160
Instruction
stringlengths
18
2k
Response
stringlengths
8
2k
Cannot call chown inside Docker container (Docker for Windows)
I am attempting to use theofficial Mongo dockerfileto boot up a database, I am using the-vcommand to map a local directory to/datainside the container.As part of theDockerfile, it attempts to chown this directory to the user mongodb:RUN mkdir -p /data/db /data/configdb \ && chown -R mongodb:mongodb /data/db /data/c...
You have similar issues illustrating the same error message inmongo issues 68orissue 74The host machine volume directory cannot be under/Users(or~). Try:docker run --name mongo -p 27017:27017 -v /var/lib/boot2docker/my-mongodb-data/:/data/db -d mongo --storageEngine wiredTigerThePR 470adds:WARNING: because MongoDB uses...
ECS equivalent of docker-compose's command
I have an application running using docker-compose.Now I'm migrating the application to be hosted on ECS.I'm translating the docker-compose settings to the boto3 ECS equivalents.Unfortunately I don't find an equivalent of docker-compose'scommandin theAWS CLI.
You can usecontainer transformwith boto3, that will convert docker-compose to equivalent ECS task definition. this is also base on python.container-transform is a small utility to transform various docker container formats to one another.Currently, container-transform can parse and convert:Kubernetes Pod specsECS task ...
How do I make a Docker hub use the same image for "latest" and "vX.Y"?
Docker Hub builds aSyncthing imagefor me fromthis source repo.I tagged thelatest commitv0.13.5, but Docker built it twice:once forlatestandonce for v0.13.5.Why? Shouldn't it be able to figure out the source is the same? Am I just doing something dumb in myDockerfile, breaking caching? Is there some way I need to hint t...
With a little magic, Docker Hubcando this!Pablo Chico de Guzmánhelped me out.Steps:add a file calledhooks/post_pushmakehooks/post_pushexecutable, commit and pushdelete the "Branch" build, but leave the "Tag" build in placeNow, any tags I push (e.g.git push --tags) fire off an automated build, and the same image is also...
Error when running docker container "NoClassDefFoundError"
I am trying to dockerize a simple Spring Boot Application, built with Maven.Dockerfile:FROM openjdk:latest COPY target/backend-1.0-SNAPSHOT.jar app.jar ENTRYPOINT ["java","-jar","app.jar"]When I run the .jar without the container (java -jar target/backend-1.0-SNAPSHOT.jar), everything works fine and the app is running....
In your pom.xml, thecopy-dependenciesgoal is specified at theinstallphase : too late the package of the jar was already done.I am trying to dockerize a simple Spring Boot Application, built with Maven.You don't need to declare any plugin to create a fat jar with spring boot that could be run by a docker container.Dec...
How to Change the Size of /dev/shm in App Engine Flexible
How do you change the size of the shared memory folder/dev/shmin an App Engine Flexible app?By default it is set to 64M, too low to run many apps (e.g., chrome). I don't see any way to change it. There are ways to change it if you have access to thedocker run command, but we don't have such access when launching app e...
A: No.Unfortunately this isn't possible (yet?) with appengine. More than a few people have run into this issue. For some reason, the container default for /dev/shm is crazy small....but there are other optionsIf the process you want to run has the ability to configure the location of the tmpfs it uses, then you cancrea...
Catching SIGTERM from alpine image
I was trying to catch SIGTERM signal from a docker instance (basically when docker stop is called) but couldn't find a way since I have different results for each try I performed.Following is the setup I haveDockerfileFROM gitlab/gitlab-runner:alpine COPY ./start.sh /start.sh ENTRYPOINT ["/start.sh"]start.sh#!/bin/ba...
I can reproduce the issue you raise, while it does not show up when I replace the base image withdebian:10, for example.It happens the issue is not due toalpinebut to thegitlab/gitlab-runner:alpineimage itself, namelythisDockerfilecontains the following line:STOPSIGNAL SIGQUITTo be more precise, the line above meansdoc...
How to ensure to update Docker image on AWS ECS?
I use Docker Hub to store a private Docker image, the repository has a webhook that once the image is updated it calls a service I built to:update the ECS task definitionupdate the ECS servicederegister the old ECS task definitionThe service is running accordingly. After it runs ECS creates a new task with the new task...
After analysing the AWS ECS logs I found out that the problem was in the ECS Docker authentication.To solve that I've added the following data to the file /etc/ecs/ecs.configECS_CLUSTER=default ECS_ENGINE_AUTH_TYPE=dockercfg ECS_ENGINE_AUTH_DATA={"https://index.docker.io/v1/":{"auth":"YOUR_DOCKER_HUB_AUTH","email":"YOU...
Heroku: How to release an existing image in gitlab CI/CD?
I would like to deploy my application as a container from Gitlab CI/CD pipeline.A few days ago I could deploy my docker image as written in the heroku devCenter.docker login --username=_ --password=$(heroku auth:token) registry.heroku.comand pushed it to the heroku registry.docker tag imageregistry.heroku.com/app/proce...
Here's a working solution I found yesterday which trigger a release. You can keep your deployment with docker and just add this little script to your pipeline.#!/bin/bash imageId=$(docker inspect registry.heroku.com/$YOUR_HEROKU_APP/web --format={{.Id}}) payload='{"updates":[{"type":"web","docker_image":"'"$imageId"'"}...
How can I login to multiple docker registries at same time?
I want to know if docker can login to multiple repos at time and if it can push the images to them simultaneously. For example, push multiple images to AWS and Azure registries at a same time.
You can login to multiple registries at the same time, but you have to push them separately, in bash you can execute commands in parallel by adding an ampersand&behind your command, for example:docker push [MY-IMAGE] my.private.registry & docker push [MY-IMAGE] my.private.registry2 &
Ignoring visible gpu device with compute capability 3.0. The minimum required Cuda capability is 3.5
I am running Tensorflow 1.5.0 on a docker container because i need to use a version that doesn't use the AVX bytecodes because the hardware i am running on is too old to support it.I finally got tensorflow-gpu to import correctly (after downgrading the docker image to tf 1.5.0) but now when i run any code to detect the...
You need to build TensorFlow from source, the typical wheels that you install using pip were built with the requirement of using Compute Capability 3.5, but TensorFlow does indeed support Compute Capability 3.0:https://www.tensorflow.org/install/install_sourcesGPU card with CUDA Compute Capability 3.0 or higher. See NV...
Docker reserve a certain amount of memory for container
I'm runningnpminside a docker container and every so often it aborts because it cannot allocate enough memory. I see some flags like--memory(How do I set resources allocated to a container using docker?) for thedocker runcommand that seem to limit the maximum amount of memory that a container can consume, but haven't s...
This is not how memory management works under Linux.If you run full virtualization, like QEMU, then all memory can be allocated and passed down into the VM. That VM then boots the kernel and the memory is managed by the kernel in the VM.In Docker, or any other container/namespace system, the memory is managed by the ke...
Issue with docker compose: container command not found
I'm having an issue when trying to start multiple containers with docker-compose:Dockerfile:FROM nginx:1.9 ADD ./nginx-sites/default /etc/nginx/sites-available/defaultdocker-compose.yml:version: "2" services: web: build: . ports: - "80:80" volumes: - ./src:/var/www links: - fpm fpm...
Like mentioned in the comments to the original question thephp:fpmimage requires for it's volume to be set to/var/www/html.If you want to use a different dir you can work around that by using your own Dockerfile (based on php:fpm). ThatDockerfilewould like this:FROM php:fpm WORKDIR /var/wwwIt seems like setting the wo...
Install package on Travis-ci with sudo:false [closed]
Closed.This question does not meetStack Overflow guidelines. It is not currently accepting answers.This question does not appear to be abouta specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic onanother Stack Exchange site, ...
Yes you can, at least some.Travis has awhitelist of allowed packagesyou can install from using the containerised environment. Instead of using wget and dpkg, or apt, you define the packages in your yaml under theaddonssection. Checkhttps://docs.travis-ci.com/user/installing-dependencies/.In the yaml you'd have somethin...
Is there a way to sandbox test execution with pytest, especially filesystem access?
I'm interested in executing potentially untrusted tests with pytest in some kind of sandbox, like docker, similarly to what continuous integration services do.I understand that to properly sandbox a python process you need OS-level isolation, like running the tests in a disposable chroot/container, but in my use case I...
After quite a bit of research I didn't find any ready-made way for pytest to run a project tests with OS-level isolation and in a disposable environment. Many approaches are possible and have advantages and disadvantages, but most of them have more moving parts that I would feel comfortable with.The absolute minimal (b...
Can't Connect Mongodb to Springboot Container in docker
I have tried many options to access the MongoDB image from docker. It works fine outside the docker but If I run the application in docker container it shows me an error. Mentioned below are screenshots of errors. Also, shared the code of connection and commands which I am running.Exception while running spring boot ap...
ProblemYou're trying to access the DB with wrong IP/hostname. As you can see, accessinglocalhostin the spring container would resolve to that container and there's no27017port listening there. When you run the jar on docker host, it has27017port available, that's why it works.SolutionYou can use--hostnameflag indocker ...
Cannot start service app: OCI runtime create failed: container_linux.go:349
I have some troubles when I try to start my go application with docker.ERROR: for app Cannot start service app: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"./main\": permission denied": unknownIt happenes when I try to dodocker-compose upIt is my mulristage Dockerfil:#...
Set the permission to your executable it should work.RUN chmod +x ./main # Command to run the executable CMD ["./main"]
I do not get Keycloak working in docker behind Traefik
I have a domain example.org.I have docker running there with Traefik as proxy. Now I want to setup Keycloak. I want to access Keycloak on auth.example.org. This is my config (docker-compose):keycloak: image: quay.io/keycloak/keycloak restart: always command: start environment: ...
In order to get Keycloak responding properly on port 443, I need to remove theKC_HOSTNAME_PORTconfiguration, leaving me with:version: "3" services: traefik: image: docker.io/traefik command: - --api.insecure=true - --providers.docker - --entrypoints.web.address=:80 - --entrypoints.web...
docker: containers in stacks within EC2 instance do not inherit dns nameserver
I have set up an EC2 instance on AWS.Have set up my security groups properly so that the instance is able to reach the Internet, e.g.ubuntu@ip-10-17-0-78:/data$ ping www.google.com PING www.google.com (216.58.211.164) 56(84) bytes of data. 64 bytes from dub08s01-in-f4.1e100.net (216.58.211.164): icmp_seq=1 ttl=46 time=...
I just ran into a similar issue. I realize this is 11 months old, but its somewhat difficult to find information on this topic, so I will post information here.My issue turned out to be that the default subnet for the docker swarm overlay network was overlapping with my vpcs subnet, so the default amazon ec2 dns server...
How to do deterministic builds of Docker images?
I'm trying to build Docker images and I would like my Docker images to be deterministic. Much to my surprise I found that even a trivial Dockerfile such asFROM scratch ENV a bProduces different IDs when built repeatedly usingdocker build --no-cache .How could I make my builds deterministic and whats causing the changes...
AFAIK, currently docker images do not hash to byte-exact hashes, since the metadata currently contains stateful information such as created date. You can check out thedesign doc from 1.10. Unfortunately, it looks like the history metadata is an important part of image validity and identification.Don't get me wrong, I'm...
Enable broadcasts between docker containers
I've been trying to enable some UDP discovery between a few containers. It tuned out that containers have disabled broadcasts by default, missing brd for inet in:$ ip addr show dev eth0 27: eth0: mtu 1500 qdisc noqueue state UP link/ether 00:00:01:4f:6a:47 brd ff:ff:ff:ff:ff:ff inet 172.17.0.12/16 scope globa...
As of now (Docker 18.06+) UDP broadcasts work out of the box, as long as your are using the default bridge networkandall containers run on thesamehost (and of course in the same docker network).Using docker-compose services are automagically run in the same network and thus the followingdocker-compose.yml:version: '3.4...
Docker with '--user' can not write to volume with different ownership
I've played a lot with any rights combinations to make docker to work, but... at first my environment:Ubuntu linux 15.04 and Docker version 1.5.0, build a8a31ef.I have a directory '/test/dockervolume' and two users user1 and user2 in a group userschown user1.users /test/dockervolume chmod 775 /test/dockervolume ls -la ...
docker's --user parameter changes just id not a group id within a docker. So, within a docker I have:id uid=1002 gid=0(root) groups=0(root)and it is not like in original system where I have groups=1000(users)So, one workaround might be mapping passwd and group files into a docker.-v /etc/docker/passwd:/etc/passwd:ro -v...
Docker CMD weirdness when ENTRYPOINT is a shell script
Here's a simple DockerfileFROM centos:6.6 ENTRYPOINT ["/bin/bash", "-l", "-c"] CMD ["echo", "foo"]Unfortunately it doesn't work. Nothing is echo'd when you run the resulting container that's built.If you comment out theENTRYPOINTthen it works. However, if you set theENTRYPOINTto/bin/sh -c, then it fails againFROM cento...
Note that thedefault entry point/cmd for an official centos 6 imageis:no entrypointonlyCMD ["/bin/bash"]If you are using the-ccommand, you need to passoneargument (which is the full command):"echo foo".Not a series of arguments (CMD ["echo", "foo"]).As stated indockerfile CMDsection:If you use the shell form of the CMD...
Parallel code execution in Docker containers
I have a script that scrapes data by URLslist. This script is executing in a docker container. I would like to run it in multiple instances, for example, 20. For that, I wanted to usedocker-compose scale worker=20and to pass the INDEX to each instance so that the script knows which URLs should bescraped.Example.ID, URL...
Withdocker-compose,I don't believe there's any support for this. However, with swarm mode, which can use a similar compose file, you can pass{{.Task.Slot}}as an environment variable usingservice templates. E.g.version: '3' services: test: image: busybox command: /bin/sh -c "echo My task number is $$task_id &&...
Docker-compose with podman?
How i use docker-composer file in podman?This examples:version: '3.7' services: gitea: image: gitea/gitea:latest environment: - DB_TYPE=postgres - DB_HOST=db:5432 - DB_NAME= - DB_USER= - DB_PASSWD= restart: always volumes: - git_data:/data ports: - 3000:30...
The upcoming Podman 3.0 supports the Docker REST API well enough to be used as back-end for docker-compose. It is planned to be released in a few weeks (seePodman releases).Caveats:Running Podman as root is supported, but not yet running as a normal user, i.e. running "rootless". (Seefeature request)Functionality relat...
App opens console window when being build with Docker
I'm facing the issue that a .Net Core WPF application automatically opens a console window when started. This only happens when build inside a Docker container. When I build it directly on my PC, only the actual application window opens.My best guess is that this is an issue with the operating system the .Net Core imag...
I was able to reproduce this problem on both3.1-nanoserver-2009and3.1-nanoserver-2004for you.I think the problem is related to the warning printed out during build:warning NETSDK1074: The application host executable will not be customized because adding resources requires that the build be performed on Windows (excludi...
Why should you call the Docker Compose file 'compose.yaml' instead of 'docker-compose.yaml'?
I've noticed that theDocker documentationnow recommends calling Docker Compose's filecompose.yamlinstead ofdocker-compose.yaml.Is there a reason for this change? Does the newer version provide more features?
Actually, this modification is quite old since it was made in 2021 and inserted in therelease1.28.6, one of the last versions before Docker ComposeV2.It was just a file renaming activity, with no new functionalities associated which, instead, follows the usual Docker Compose releases.The main difference is that if you ...
Does Docker execute the entrypoint when a container is used in a multistage build?
If define a multistageDockerfilelike so:FROM exampleabc:latest COPY app.go . FROM alpine:latest RUN apk --no-cache add ca-certificates WORKDIR /root/ COPY --from=0 /go/src/github.com/alexellis/href-counter/app . CMD ["./app"]Would theexampleabc:latesthave it's entrypoint executed?
Fromofficial documentation:Only the last ENTRYPOINT instruction in the Dockerfile will have an effect.
How to push container to Google Container Registry (unable to create repository)
EDIT: I'm just going to blame this on platform inconsistencies. I have given up on pushing to the Google Cloud Container Registry for now, and have created an Ubuntu VM where I'm doing it instead. I have voted to close this question as well, for the reasons stated previously, and also as this should probably have been ...
I am still not able to push a docker image from my local machine, but authorizing a compute instance with my account and pushing an image from there works. If you run into this issue, I recommend creating a Compute Engine instance (for yourself), authorizing an account withgcloud auththat can push containers, and pushi...
How to communicate between Fargate services on AWS ECS?
I have six docker containers all running in their own Tasks (6 tasks), and each task running in a separate Fargate service (6 services) on ECS. I need the services to be able to communicate with each other, and some of them need to be publically accessible. I keep seeing info about using either Service Discovery or a L...
Based on the comments, the exact cause of the issue isundetermined. However, the problem was solved by creating anew Service Discoveryin ECS.
How to change the IP address of a docker after creating it?
I have a docker linked to a bridge with IP address192.168.150.1/24. Once I create the docker instance from a docker image it gets an IP address,192.168.150.2, but according to my requirement, this IP address,192.168.150.2, must be reserved since I want to use it for some other thing.Now, I want to change the IP address...
You will have to first detach the container from the custom network and the connect it back by providing the ip.You can follow the following steps :docker network disconnect [OPTIONS] NETWORK CONTAINERdocker network connect --ip 192.168.150.3 NETWORK CONTAINER
Communication between two microservices by Docker hostname
How it works now:Microservice X makes REST API request to Microservice Y with static iphttp://{ip-address}:{port}/doSomethingThe problem:The problem is that I can no long guarantee that static ip. I wan't to solve this by using the docker hostname instead:http://hostname:{port}/doSomethingI tried achieving this by crea...
The solution is very simple, instead of using IPs or Hostnames you can use the service's name.In your example, in thestreamappservice you can access the other by usinghttp://storeapp:8080.Similar, in thestoreappservice you can access the other athttp://streamapp:8080.Please not that you must use the internal ports, no...
Docker - How to build image for M1 Mac or AMD conditionally from Dockerfile?
Some context:-I'm aDockernewbie (on it since 1 day),-I've got a smallVMrunninglinux/AMDand I own a M1 Mac (ARM),-I'd like to also use Container for Dev (instead of virtual env).For building my container forprod, being on a M1 Mac, I have the belowDockerfile:See the--platform=linux/amd64arg inFROMand It works (= I'm abl...
I believe you can use the--platformparameter ondocker buildx buildordocker buildto set platform(s) to build the image which will be used within anyFROMcalls within theDockerfileif nothing else is specified (seeDockerfile FROM), as mentioned in the documentation.You can then use theTARGETPLATFORMvariable within yourDock...
Docker: Edit "my.cnf" file in stopped container
After making an edit to "my.cnf", I now get an error from Kitematic on the Mac when I attempt to start the container:mysqld: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 19! mysqld: [ERROR] Fatal error in defaults handling. Program aborted!I've tried accessing the conta...
To fix the my.cnf, you can usedocker container cp. It works with stopped containers.To copy file from your container to current pathdocker container cp containerId:/etc/mysql/my.cnf container-my.cnfThen edit container-my.cnf and copy back from path to container :docker container cp container-my.cnf containerId:/etc/mys...
ConnectTimeoutError while running 'pip install' via docker-compose
I'm new to docker and currently trying to build an image for my Django project. Here's myDockerfile:FROM python:3.8.5-alpine WORKDIR /my_project ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 RUN pip install --upgrade pip COPY ./requirements.txt . RUN pip install -r requirements.txt COPY . .When I rundocker-co...
Sound there is some issue with the network connectivity while build the docker container. UseHostas an network inside compose file to resolve the issue.version: '3.4' services: django_image: build: context: . network: hostGive it a try and it will solve the issue.
`Docker logs` erroneously appears empty until container stops
When running a Docker container that calls a Python process, runningdocker logs #####will return nothing, despite events happening inside the container which emit tostdout. Noting appears in the logs until I rundocker stop ######, in which case the expected output is returned. The same is true withdocker logs -f #####—...
This might be happening because stdout and stderr are buffered streams.When interactive, stdout and stderr streams are line-buffered. Otherwise, they are block-buffered like regular text files. You can override this value with the -u command-line option.Try adding the -u flag.CMD [ "python", "-u", "./your_script.py" ]O...
Azure container app, unable to pull from private registry
I have just created an Azure Container App and I am trying to link it to a private repository on docker.io. It works if I make it pull a public image but not if it's private, even though I specified all the information. I have also used the automatic "continuous deployment" with github (the azure portal basically did e...
This is a known issue and container apps team is working on it. As a workaround, useregistry.hub.docker.comas the server value instead ofdocker.io.
mysqli not found in (php-fpm) docker container
I'm runningphp:7-fpmin a docker container that is used by my nginx web server. Everything is working nicely except for when I'm trying to instantiate a mysqli connection in my PHP code. I receive the following error:"NOTICE: PHP message: PHP Fatal error: Uncaught Error: Class 'Listener\mysqli' not found in index.php:1...
Your problem isn't that you're missing the mysqli extension.If you're doing something like this:namespace Listener; class Foo { public function bar() { $conn = new mysqli(...); } }Then PHP will interpretnew mysqli()asnew \Listener\mysqli()because you're currently in the\Listenernamespace. To fix this, ...
Embed code in docker container or mount it as a volume?
I'm a recent user of docker and I am about to migrate from VM to containers in my production environment. But then, I suddenly realize that what works perfectly for my dev and qa environments is not ideal for production.On my dev and qa, I mount my versioned project folder into a python/php (name it) container and I co...
I do the same for in my development environment. I have a production Dockerfile that ADDs the project folder and then I run all the tests against it. Since the only difference between the development container and the production container is when the code is added to the container, not the code or settings, they have t...
How to access cloud run environment variables in Dockerfile
I have built a containerised python application which runs without issue locally using a.envfile and and adocker-compose.ymlfile compiled withcompose build.I am then able to use variables within the Dockerfile like this.ARG APP_USR ENV APP_USR ${APP_USR} ARG APP_PASS ENV APP_PASS ${APP__PASS} RUN pip install https://...
My understanding is that it is not possible todirectlyuse a Cloud Run revision'senvironment variablesin the Dockerfile because the build is managed by Cloud Build, which doesn't know about Cloud Run revision before the deployment.But I was able to use Secret Manager'ssecretsin the Dockerfile.Sources:Passing secrets fro...
Google Container Registry permission
I am trying to push docker image to GCP, but i am still getting this error:unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authenticationI fol...
If it can help those in the same situation as me:Docker 19.03Google cloud SDK 288.0.0Important: My user is not in adockeruser group. I then have to prependsudobefore any docker commandWhengcloudanddockerare not using the same config.jsonWhen I use gcloud credential helper:gcloud auth configure-dockerit updates the JSON...
Performance issues running a database in a docker container
Has anyone noticed any performance issues running a database (MySQL or Postgres) in a docker container, I'm told that severe performance degradation occurs.Please advise.
Docker itself imposes very little overhead, it's just isolating the process from other processes on the host. However, there are lots of things you can do to degrade the performance of a container:Run it inside Windows/MacOS while only giving the embedded VM a fraction of the memory/CPU of the parent OS.Restrict CPU or...
How to load shell aliases in an alpine docker container with start
I have written a DOCKER file, which uses as an image an private adapted alpine image, which contains a nginx server. Note: alpine uses zsh, not bash.I love to have some shell aliases available, when working in the container and it drives me nuts, when they are missing. So I copy a small prepared file to /root/.profile,...
By default docker start a non-login shell. To read .profile file you need a login shelldocker exec -it ash -l.To read /etc/profile (or another startup file) everytime, you've to set ENV variable.Example DockerfileARG PHPVERSION=7.4 FROM php:$PHPVERSION-fpm-alpine ARG PHPVERSION=7.4 ENV PHPVERSION_ENV=$PHPVERSION # c...
Why have docker-compose volumes to be declared twice when not pointing to an actual folder on the host?
In adocker-compose.yml file, do I really need to specify thevolumestwice; insideandoutside a service? If yes, Why? (the docker-compose part of the doc doesn't have much information on that)I have thefeelingthat, in the case shown here where themyappvolume is not explicitly a folder on the host machine, wehaveto set it ...
This is a whole bunch of questions - let's try to answer them sequentially:1. Do I really need to specify the volumes twice (inside and outside the services section)?This is not a duplicate specification: outside youdeclarethe volume and inside you specify how tomountit into a container. A volume has an independent lif...
Export Query Result as CSV file from Docker PostgreSQL container to local machine
I'm not sure if this is possible of if I'm doing something wrong since I'm still pretty new to Docker. Basically, I want to export a query result inside PostgreSQL docker container as a csv file to my local machine.This is where I got so far. Firstly, I run my PostgreSQL docker container with this command:sudo docker r...
You can export the data to theSTDOUTand pipe the result to a file in the client machine:docker exec -it -u database_user_name container_name \ psql -d database_name -c "COPY (SELECT * FROM table) TO STDOUT CSV" > output.csv-ctells psql you to execute a given SQL statement when the connection is established.So your comm...
Docker stats 100% memory
I've a container which is running a java application with the following jvm arguments:-XX:+UseG1GC -Xms512m -Xmx2048m -XX:MaxPermSize=256mI'm using docker memory limit option:docker run -it -m 2304m foo bashRunningdocker stats myAppright after the container initialization will give me:CONTAINER CPU % MEM USAGE/LIM...
Lets start with this:-XX:+UseG1GC -Xms512m -Xmx2048m -XX:MaxPermSize=256mThat says, use a heap that starts at 0.5Gb and can grow to 2GB, and also a permgen heap of 0.25GB. And that does not include the JVM's other non-heap usage; e.g. memory mapped files, thread stacks, cached JAR files, etc.Then you say that docker i...
How to delete a repo from Docker Hub
How do I delete a repository from Docker Hub entirely?Docker is evolving fast and so is their website. Here is the latest route to deleting your repo from docker hub web interface.
Firstly, make sure you are logged into hub.docker.comSimpleClick Repositories link (on blue menu bar) on topClick the name of repo to be deletedClick Settings link (on white sub menu bar)Click the 'Delete repository' buttonIn the confirmation dialog box, type the name of your repo to reconfirmClick DeleteDetailedClick ...
Securing credentials for private PyPi in Docker
I am building a Docker image and need to run pip install vs a private PyPi with credentials. What is the best way to secure the credentials? Using various file configuration options (pip.conf, requirements.txt, .netrc) is still a vulnerability even if I delete them because they can be recovered. Environment variables a...
I understand that you want to provide those credentials on build time and get rid of them afterwards.Well, the most secure way to handle this withpipwould be by using a multi-stage build process.First, you would declare an initialbuild-imagewith the file configurations and any dependency that could be needed to downloa...
How to run a docker command in Jenkins Build Execute Shell
I'm new to Jenkins and I have been searching around but I couldn't find what I was looking for.I'd like to know how to run docker command in Jenkins (Build - Execute Shell):Example:docker run hello-worldI have set Docker Installation for "Install latest from docker.io" in Jenkins Configure System and also have installe...
One of the following plugins should work fine:CloudBees Docker Custom Build Environment PluginCloudBees Docker Pipeline PluginI normally run my builds on slave nodes that have docker pre-installed.
ERROR: unsatisfiable constraints - on php:7-fpm-alpine
I'm looking at setting up laravel on an fpm-alpine container. Running into a snag where the below Dockerfile is producing some errors...FROM php:7-fpm-alpine # install extensions needed for Laravel RUN apk --update add \ php7-mysqli \ php7-mcrypt \ php7-mbstring \ rm /var/cache/apk/*Errors produced are:Buildi...
I wasn't usingdocker-php-ext-installwhich is required when adding working within the container...FROM php:7-fpm-alpine # install extensions needed for Laravel RUN apk update \ && apk add libmcrypt-dev \ && docker-php-ext-install mcrypt mysqli pdo_mysql \ && rm /var/cache/apk/*
How can i get my container to go from starting -> healthy
Background: My Docker container has a very long startup time, and it is hard to predict when it is done. And when the health check kicks in, it first may show 'unhealthy' since the startup is sometimes not finished. This may cause a restart or container removal from our automation tools.My specific question is if I can...
My specific question is if I can control my container so that it shows 'starting' until the setup is ready and that the health check can somehow be started immediately after that?I don't think that it is possible with just K8s or Docker.Containers are not designed to communicate with Docker Daemon or Kubernetes to tell...
AH01114: HTTP: failed to make connection to backend: localhost (apache as docker container)
I am trying to setup apache in front of a server application (JIRA) on my local machine. Somewhat based on:https://mimiz.github.io/2017/05/18/Configure-docker-httpd-image.htmlBoth apache and the server application are run as docker containers.Starting my server application works fine and I can access the web-ui at:http...
Please referhttps://docs.docker.com/network/network-tutorial-standalone/It should be configured : ServerName localhost ProxyPass / http://172.17.0.1:8087 or : ServerName localhost ProxyPass / http://ip_addressof_my-server-container:8087 Use:docker inspect container_idto see ip address of container.
How can I set runtime variable for docker compose environment variable
I am creating a docker compose file which requires some environment variables. One of the env var is from aws ssm parameter. So I need to query the value from aws ssm when I build the docker image and put the value as one of the environment variable. How can I do that in docker compose file?version: "2.3" services: b...
There is no easy way to processARGsin docker-compose file from a subshell. But you can do this withdocker buildcommand and docker-compose with key-value.using the docker-compose command:MY_KEY=$(aws ssm get-parameter --name "test" --output text --query Parameter.Value) docker-compose build --no-cachedocker-composevers...
How do you change default detach key sequence in docker?
Docker container's detach key sequence by default is control+q or control+p. There is an option to set key sequence when starting a container using--detach-keys ""but I am looking for a permanent change.Is there a way to change this key sequence to something else?
Per user, you can configure this in the$HOME/.docker/config.jsonfile. Add a json entry similar to:{ "auths": { ... }, "detachKeys": "ctrl-x,x" }The "auths" line is just giving a relative location in the json, ignore this if you don't have an existing logins stored in this file. Seethis documentationfor more details...
Dockerized Node js app does not start
After dockerizing my demo Express js app and starting the container, I am unable to access the service due to a"Connection Timeout"Url for the for project before dockerizing (Which produced "Hello world!" on the browser):http://localhost:3000/cars/example/fetchResultUrl for the project after starting the docker contain...
TheEXPOSEinstruction informs Docker that the container listens on the specified network ports at runtime.EXPOSEdoes not make the ports of the container accessible to the host.To do that, you must use either the-pflagYourdocker runcommand should look like this:$docker run -p3000:3000 -t prasannarb/example-node-serviceAd...
k3d tries to pull Docker image instead of using the local one
Just study the core of K8S on local machine (Linux Mint 20.2).Created one node cluster locally with:k3d cluster create myclusterAnd now I want to run spring boot application in a container.I build local image:library:0.1.0And here is snippet fromDeployment.yml:spec: terminationGracePeriodSeconds: 40 containers: ...
If you don't want to use a docker registry, you have to import the locally built image into the k3d cluster:k3d image import [IMAGE | ARCHIVE [IMAGE | ARCHIVE...]] [flags]But don't forget to configure in your deployment:imagePullPolicy: Never
How to run multiple JVM params in docker-compose?
I got this list of JVM params from the following answerhttps://stackoverflow.com/a/35108974/7809534:-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=falseAnd I woul...
Eventually, I managed to find a solution.Here it is:environment: - JAVA_TOOL_OPTIONS= -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management...
How to communicate between two docker containers (mssql and .net core app) got Connection refused 127.0.0.1:1433
I have a.net core 2.0project which usesmssql server. I have Created adocker imageand container for my.net core 2.0and running on9090:9090. I created it like below.docker container run --name mytestapp --publish 9090:9090 --detach my_.netapp_image_nameand below is my connection string in .net core 2.0 app."DefaultConnec...
Containers each have their own network namespace by default. Compose will place all containers on a shared network and set an alias in DNS for the service name. So to connect between containers, all you need to do is point to your service name instead of the 127.0.0.1 (assuming mysql is your service name):"DefaultConne...
How to add module to Wildfly using CLI
I'm trying to create a Wildfly docker image with a postgres datasource.When I build the dockerfile it always fails with Permission Denied when I try to install the postgres module.My dockerfile looks look this:FROM wildflyext/wildfly-camel RUN /opt/jboss/wildfly/bin/add-user.sh admin admin --silent ADD postgresql-9.4-...
It seems the JAR file is not readable by thejbossuser (the user comming from parent image). Thepostgresql-9.4-1201.jdbc41.jaris added under the root user - find details inthis GitHub discussion.You couldeitheradd permissions to JAR filebefore adding it to the imageor add permissions to JAR file in the image after the a...
Docker shared folder with Linux
Hello I have problem with sharing resources with docker. I got folderDocuments/Volume/In folder Volume I have file data.txt Now when I run image like this:docker run -v /Documents/Volume:/Volume -it busyboxI would expect that in folder Volume I will see file data.txt but file is missing. So I create new file in folder ...
-vvolume parameter expects path to be absolute.You need to pass full path to the folder like:/var/share/Volumebut not just relative path you did justVolumeI use this trick when need relative path-v $(pwd)/Volume:/data/Volume
how can i pass arguments or bypass it in docker build process? [duplicate]
This question already has answers here:How to fill user input for interactive command for "RUN" command?(2 answers)Closed1 year ago.I writing a Dockerfile for my PHP application, and instead of from dockerhub i am creating it from scratch.eg:FROM ubuntu:18.04 RUN apt-get update && \ apt-get install -y --no-inst...
You could set the environment variablesDEBIAN_FRONTEND=noninteractiveandDEBCONF_NONINTERACTIVE_SEEN=truein your Dockerfile, beforeRUN sudo apt-get install php libapache2-mod-php -y.Your Dockerfile should look like this:FROM ubuntu:18.04 RUN apt-get update && \ apt-get install -y --no-install-recommends apt-uti...
Netstat not showing ports exposed by docker
For some reasonnetstatis not listing ports exposed by docker. As suggestedhereI usedEXPOSEfor both ports 8080 and 5050. But none of them is visible from host.Dockerfile... FROM openjdk:11-jre-slim COPY --from=build /usr/src/app/api/target/track-metadata-api-*.jar /app/track-metadata-api.jar WORKDIR /app EXPOSE 808...
Problem was innetstatcommand, after adding-anpflag, ports are listed.$ sudo netstat -anp | grep 8080 tcp6 0 0 :::8080 :::* LISTEN 16341/docker-proxy
Real-time output for Paramiko exec_command [duplicate]
This question already has answers here:Paramiko with continuous stdout(2 answers)Closed2 years ago.NOTE: I have seen other posts on this, but not a single post can explain the answer, nor do they have one that works.Is there a way to get the output ofexec_command, specifically forexec_command('docker run ')in real-time...
You may read lines fromChannelFile(http://docs.paramiko.org/en/2.4/api/channel.html?highlight=stdout#paramiko.channel.ChannelFile).Example:stdin, stdout, stderr = client.exec_command('docker run ') while True: line = stdout.readline() if not line: break print(line, end="")
Import osm data in Docker postgresql
i am trying to use Docker. So i installed in Docker postgresql image.Until now, when i imported osm data into postql i used this command:psql -U postgres mydb CREATE EXTENSION postgis; osm2pgsql -U postgres -d mydb -s -S ./osm_stylesheet /home/ramnikov/Downloads/hessen-latest.osmHow can i do the same inside Docker a...
You can executeosm2pgsqloutside of Docker:-H|--host Database server host name or socket location.As well aspsql:-h, --host=HOSTNAME database server host or socket directoryLike this:psql -h dockerIP -U postgres -d mydb -c 'create extension postgis' osm2pgsql -H dockerIP -U postgres -d mydb -s -S ./osm_styl...
Docker images eats up lots of space?
docker ps -aqShows only 7-9 images./var/lib/docker/graphshows me n number of images.When I create a file, I get write error due to system full error. I tried to create symbolic link. but I cannot able to move all the docker things.Is it good to remove everything under /var/lib/docker/graph? What are the other possibili...
To get rid of "dangling" images, run the following:$ docker rmi $(docker images -q -f dangling=true)That should clear out all the images marked "none". Be aware however, that images will share base layers, so the total amount of diskspace used by Docker will be considerably less than what you get by adding up the sizes...
Sending signals to Golang application in Docker
I am trying to run servers written in golang inside docker containers. For example:package main import "net/http" func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello")) }) http.ListenAndServe(":3000", nil) }If I run this code on my local machine, I can sen...
You are running your server inside a shell, and the shell is the process receiving the signals. Your server doesn't exit until you force the shell to quit.When you use the "shell" form of CMD, it starts your server as an argument to/bin/sh -c. In order to exec the server binary directly, you need to provide an array of...
Docker CentOS systemctl not permitted
I trying to build a CentOS image with systemctl command. But each timewhen I build it. I obtain this error :Step 5/7 : RUN systemctl enable syslog-ng ; systemctl start syslog-ng ---> Running in 8f5a357895e7 Failed to get D-Bus connection: Operation not permitted The command '/bin/sh -c systemctl enable syslog-ng ; sys...
You should assume systemd and systemctl just don't work in Docker, and find another approach to whatever your higher-level goals are. Best practices are to run one service and one service only in a Docker container, and to use multiple containers if you need multiple coordinating services; if you really must run multi...
Why would anyone use the same network namespace for two docker containers?
Why would you connect two docker containers via network namespace, and not just through one network?As far as I know the only difference is that you can call the other container using localhost. I don't see any use case where this would be necessary.Does anyone have experience with this?
One reason I can think of is forusing a tool or commandthat is not available in your container. This example below comes directly from thedocker rundocs:NETWORK: CONTAINERExample running a Redis container with Redis binding tolocalhostthen running theredis-clicommand and connecting to the Redis server over thelocalhost...
Deploying nodejs project from gitlab ci
I am new to node.js, I was trying to deploy node.Js project via gitlab ci. But after spotting the build error in pipeline I realized I added node_modules folder to .gitignore, and I am not pushing node_modules to gitlab. And node_modules folder is 889MB locally there is no way I will push it, so what approach shou...
You are right not to check in thenode_modulesfolder, they are automatically populated at the time you runnpm installThis should be part of your build pipeline in the gitlab ci. The pipeline allows multiple steps and the ability to pass artefacts through to the next stage. In your case you want to save thenode_modules...
Error on Docker Pull - "Layer already being pulled by another client"
I'm new to docker and have followed the installation instructions on their sitehere.The installation completed successfully:docker -v Docker version 1.8.1, build d12ea79but when I try to runsudo docker run hello-worldI get the following:Unable to find image 'hello-world:latest' locally latest: Pulling from library/hell...
This seems to have now resolved itself. Quite possibly it was caused by a problem at docker's end.
How can i get logs of laravel in docker behind php-fpm?
During developing we met some problems with getting the real error log of the code.Architecturenginx -> php-fpm with laravelProblemcan't get the logs of laravelEnviromentimage php:7.2.8-fpm-alpine3.7docker 18.06.1-celaravel 5.5www.conf[www] user = www-data group = www-data listen = 127.0.0.1:9000 clear_env = no catch_w...
Add stderr/stdout to the logging stack in config/logging.phpThis was discussed before here, and Taylor added an example to stderr output (php://stderr) in the config/logging.php shipped with laravelhttps://github.com/laravel/ideas/issues/126or just change the .env LOG_CHANNEL example quoting original comment:https://gi...
Pull Artifactory Docker Images
I downloaded artifactory 6.6.0 on remote desktop with ip (x.x.x.x) and connect to port 8081.I can connect to artifactory from my computerhttp://x.x.x.x:8081/artifactory. I have docker client on my computer but I don't have docker on remote desktop.I have virtual docker repository named "docker".I want to login by docke...
First: docker login related to Artifactory -> Configurations -> HTTP Settings I used "Docker access method" as "Repository path"docker login -u admin -p **** x.x.x.x:8081Second: Since i use HTTP, this ip "x.x.x.x:8081" should be added to "insecure-registries" in Docker client.or just add it to insecure registries in ~...
How to use rolling update to re-pull container image?
I have a kubernetes RC/pod consisting of containers with images like:foobar/my-image:[branch]-latestwhere "branch" is the git branch ("master", etc).What's the best way to use rolling-update to force the RC to re-pull the images to get the latest version? The brute force method is to simply delete the RC and re-create ...
You should be able to use arolling updatespecifying the same image name that you are currently using:kubectl rolling-update --image=foobar/myimage:[branch]-latestThis will (behind the scenes) create a new replication controller that is a copy of your existing replication controller with the "new" image, and then stepw...
How to configure Prometheus in a multi-location scenario?
I love using Prometheus for monitoring and alerting. Until now, all my targets (nodes and containers) lived on the same network as the monitoring server.But now I'm facing a scenario, where we will deploy our application stack (as a bunch of Docker containers) to several client machines in thier networks. Nearly all of...
Nobody posted an answer so I will try to give my opinion on the second choice because that's what I think I would do in your situation.The second setup seems the most flexible, you have access to the datas and only need to open one port on for the federating server, so it should still be secure.One other bonus of this ...
Override FROM image's ENV in Dockerfile
From the following image:https://registry.hub.docker.com/u/cloudesire/activemq/dockerfile/If I wanted to override the ACTIVEMQ_VERSION environment variable in my child docker file, I assumed I would be able to do something like the following:FROM cloudesire/activemq:latest MAINTAINER abc <[email protected]> ENV ACTIVEM...
That won't work. TheACTIVEMQ_VERSIONhas already been used by thecloudesire/activemq:latestimage build to populate its image layers. All the ActiveMQ installation files based on version5.11.1are already extracted in their corresponding directories.In yourDockerfileyou only can build on top of what has already been build...
How to mount docker volume into my docker project using compose?
I have a Maven project. I'm running my Maven builds inside Docker. But the problem with that is it downloads all of the Maven dependencies every time I run it and it does not cache any of those Maven downloads.I found some work arounds for that, where you mount your local .m2 folder into Docker container. But this will...
Without knowing your exact configuration, I would use something like this...version: "2" services: maven: image: whatever volumes: - m2-repo:/home/foo/.m2/repository volumes: m2-repo:This will create a data volume calledm2-repothat is mapped to the/home/foo/.m2/repository(adjust path as necessary). ...
How to mount a Host folder in minikube VM
I have a use case where I need a Docker container under kubernetes to access a hostPath. I'm using minikube, and the container is able to access a folder in the minikube VirtualBox VM. But I can't figure out how to get it to access a folder on the host itself.I do these commands on the host to create /opt/foo for shari...
The problem is the firewall, in Ubuntu this worked for me:sudo ufw allow in on virbr1 sudo ufw reloadBut you need to figure out the correct interface name viaifconfig.In my case I didminikube ipto realize the interface wasvirbr1I found the solution because in the past I had connectivity problems with docker which got r...
Connect two docker containers
I have two containers, the first one with adjangoand the second one withpostgresql.Well, in my first server I have runningdjangoand I'm trying to connect it with the second one. The second container has the port32770exposed but internally running in the port5432. In my local machine, I have the connection: Server: 'Loc...
Since your are running the containers individually you have different optionsRun django on network of postgres container$ docker run -d ... postgres $ docker run -d ... --net container: djangoThen django can find postgres onlocalhost:5432Run django and postgres as named containers container$ docker run --name postgre...
Trying to install DOCKER GPG key recieving error: Curl: option '-' is unknown
I'm trying to add the docker GPG key, and I'm unable to do so because it doesn't recognize that i'm trying to pipe the GPG key into the APT KEYI'm getting back the following error (see picture):curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
You seems to have a Keyboard mapping issue where the pipe|turns into a redirect symbol>. It seems more related to Digital Ocean and their Console itself where your droplet is hosted - by the look of the image in the question - according tothis thread.The first option is to use SSH to log into your droplet.Your second o...
Docker vs. Shared windows folders
I'm trying to access a remotely shared folder from within a docker container on Docker for Windows.While inside the container runningdir \\target\shareproduces "The network path was not found.". The target can be pinged from inside the container and from the host system the share is accessible.The image used ismicrosof...
The SMB protocol works with hosts in the same LAN. A docker container, by default, has a virtual network interface behind a NAT, so the container is no longer in the same LAN. This is why you can ping the target, but you can't access the shared folder.The easier solution is to add the option--network hostto thedocker r...
Docker and systemd - service stopping after 10 seconds
I'm having trouble getting a Docker container to stay up when it's started by systemd. When I start it manually withsudo docker start containername, it stays up without trouble, but when it's started via systemd withsudo systemctl start containername, it stays up for 10 seconds then mysteriously dies, leaving messages ...
Solution: The start command seems to need the -a (attach) parameter as describedin the documentationwhen used in a systemd script. I assume this is because it by default forks to the background, although the systemdexpect daemonfeaturedoesn't appear to fix the issue.from thedocker-startmanpage:-a, --attach=true|false ...
Launching a InfluxDB container in docker with a default database name
I'm running the following command to launch aInfluxDBcontainer. This should create a new databse with the namedefaultdb.docker run -p 8086:8086 \ -e INFLUXDB_DB=defaultdb -e INFLUXDB_ADMIN_ENABLED=true \ -e INFLUXDB_ADMIN_USER=admin -e INFLUXDB_ADMIN_PASSWORD=adminpass \ -e INFLUXDB_USER=user -e INFLU...
The issue was due to theINFLUXDB_ADMIN_ENABLED=trueline.The documentation states:The administrator interface is deprecated as of 1.1.0 and will be removed in 1.3.0.I was using thelatestversion which is (currently) the1.4so it seems that there was a problem with that deprecatedINFLUXDB_ADMIN_ENABLEDvariable.Removing t...
Expose log file outside docker container
I have .net core app which Serilog as log framework. Right now Serilog are logging to file. I want to expose this file outside container and have a simple access as with other files.I tried with volume and volume-bind according to docker-compose reference:https://docs.docker.com/compose/compose-file/#volume-configurati...
You're mounting /app/logs but the env variable indicates that logs are written to /logs, not /app/logs.Change one path or the other and see if the problem is still there.In general your approach is correct. But for production usage, especially in clustered environments, it's better to use serilog, splunk, application i...
Docker: provide custom context in python-sdk
I am trying to emulate the following CLI command using the docker python-sdk:docker build -t mytag -f path_to_my_dockerfile/Dockerfile ../../../.So in this case I want it to build the Dockerfile using the build context../../../.. I tried using the python-sdk for docker but it seems each time the build context is not th...
You just need to provide thedockerfileargument:clients.images.build( path="../../../.", dockerfile="path_to_my_dockerfile/Dockerfile", tag="mytag" )Note that thedockerfileshould be relative topath, not your current working directory.If you have dockerfile and context relative to your current working directo...
linking kibana with elasticsearch
I have the following docker containers running on my box...CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 5da7523e527b kibana "/docker-entrypoint.s" About a minute ago Up About a minute 0.0.0.0:...
First of all, Linking is a legacy feature, Create a user defined network first:docker network create mynetwork --driver=bridgeNow usemynetworkfor containers you want to be able to communicate with each other.docker run -p 5601:5601 --name kibana -d --network mynetwork kibana docker run -p 9200:9200 -p 9300:9300 --name...
Connecting a Redis container with another container (Docker)
So, I'm doing a project where I have two Docker containers, one for the main app and one for Redis (using docker compose btw). Naturally I wanted to connect both and tried the default bind setting, but of course the app couldn't connect to the db due to them being in two different containers. Then I just went with 0.0....
It’s easy to make a Docker-hosted service only accessible to other containers on the same host. If you:Set the server to bind to or listen on 0.0.0.0 or ::0 (all addresses);Create a non-default Docker network (Docker Compose will do this automatically);Launch the server container and any associated client containers o...
How to pass command line arguments to a dotnet dll in a Docker image at run time?
Working on my first Docker image. It is a dotnet program that uses CMD to launch (only one CMD allowed in Docker). I would like to pass the program an argument (an API key) at runtime. After some googling, not finding a clear answer. Entrypoint doesn't seem helpful. Maybe ENV, but it seems ENV is only for Docker. My Do...
Docker joinsENTRYPOINTandCMDinto single command line, if both useJSONnotation, like in your example.This is JSON notation:CMD [ "dotnet", "/app/netcore/Somename.dll"]This is shell notation:CMD dotnet /app/netcore/Somename.dllAnother thing you need to know - what is written indocker run ... ...after- considered asCMD....
Docker refused to connect
After Idocker-compose buildanddocker-compose up, if I go tolocalhost:5000in my browser (Which is the port I exposed in the yml file), I get:This site can’t be reached. localhost refused to connect.However, if I go to192.168.99.100:5000, the container loads. Is there a way I can fix this issue?
Bind your container port to 127.0.0.1:5000.By default, if you don't specify an interface on port mapping, Docker bind that port to all available interfaces (0.0.0.0). If you want to bind a port only for localhost interface (127.0.0.1), you have to specify this interface on port binding.Dockerdocker run ... -p 127.0.0.1...
Cannot exchange AccessToken from Google API inside Docker container
I have a web app written in Go, use oauth2 (packagegolang.org/x/oauth2) to sign user in by Google (follow this tutorialhttps://developers.google.com/identity/sign-in/web/server-side-flow).When I test app on local, it works fine but when I deploy app and run inside a Docker container (base onalpine:latest, run binary fi...
The problem is not caused by Go but Alpine image.Default Alpine image does not have certificates so the app cannot call to https address (this case ishttps://accounts.google.com/o/oauth2/token).To fix this problem, install 2 packagesopensslandca-certificates. Example in Dockerfile:apk add --no-cache ca-certificates ope...
Environment variables in docker when exec docker run
I've got a problem with environment variables in docker. When I run command:$ docker run ubuntu /bin/bash -c "echo $HOME"I've got response:/Users/bylekBut when I run:$ docker run -it ubuntu /bin/bashand then:root@5e079c47affa:/# echo $HOMEI've got:/rootSecond response is correct. Why first command return $HOME value fr...
echo $HOMEis being evaluated on your host because you haven't got the syntax of the switch to bash correct. It's Linux so you need single quotes.Try replacing your double quotes with single quotes.eg. This is what I get:bash-3.2$ docker run ubuntu /bin/bash -c 'echo $HOME' /root
I run the docker images which start tomcat8 server but it don't start
I have docker image which I create from my docker file. When I run the image it has able to run the tomcat server then the command prompt come back. That mean the process is terminated and I think the container stops. So when I seehttp://localhost:8080no tomcat page is appear. So I am not able find actual what is the ...
A similardocker official tomcat image (8.0.40)runs:CMD ["catalina.sh", "run"]Withcatalina.sh made to start tomcat in the foreground: the process won't exit immediately.If you tomcat installation does include that script, you should use it instead orstartup.sh.Or run directly a tomcat image for testing:$ docker run -it ...
VSTS docker task failed on '&&' token in docker RUN command
I configuring CI for my ASP.NET Core application in VSTS (visual studio online). I've added "docker-compose build" task to build definition but it fails with errors:Step 4/9 : RUN dotnet restore QuizService.sln && dotnet publish QuizService.sln -c Release -o obj/Docker/publish ---> Running in 7ea0cf1881d1 ... r...
The problem was in incorrect build agent type. "Hosted VS2017" build agent failed to build project because it uses docker with windows containers (and powershell as a default shell). But on my dev machine I use docker with linux containers (with /bin/sh as a default shell). Choosing the correct build agent type fixed t...
Php7 Redis Client on Alpine OS
I crafted a docker image using alpine 3.5 as base Image. I want my php apllication running inside container to communicate with a redis server.But I don't find any php7-redis client in Alpine.Is there a workway around it ?I tried to use pecl to install redis but there is no pecl package in alpine.I tried with pear but ...
You can find your solution herehttps://pkgs.alpinelinux.org/package/edge/community/x86_64/php7-redis
docker secret with spring boot application is not working in docker swarm mode /run/secrets
I'm trying to set the environment variables for DB password for MySQL container and spring boot application which is commonly declared in the docker secrets.echo "db_secured_password" | docker secret create secret -here are the configuration files :spring boot application's -> application.ymldb: name: my-db host: l...
We resolved the same issue by using "printf" instead of "echo", the problem of echo is it will leave a new line character into the docker secret. You can refer to example in docker secret create =>https://docs.docker.com/engine/reference/commandline/secret_create/Also I have an example that load docker secrets directly...
Redis Docker compose Can't handle RDB format version 10
I can't start redis container in my docker-compose file. I know that docker-compose file is OK, because my colleagues can start the project successfully. I read that there is a solution to delete dump.rdb file. But I can't find it. I use Windows machine. Any suggestions will be very helpful.Error 2023-02-09 16:41:28 1:...
I would have to specify something there. I also faced such an issue, and if the solution to remove the volume is working, you can't delete a volume in use, which means you are to remove the container using the volume first...for most container / volumes, that's not an issue, but regarding to redis, if for example you a...
AWS Lambda function returns "errorMessage": "[Errno 30] Read-only file system: '/home/sbx_user1051'"
I get the following error{ "errorMessage": "[Errno 30] Read-only file system: '/home/sbx_user1051'", "errorType": "OSError", "stackTrace": [ " File \"/var/lang/lib/python3.8/imp.py\", line 234, in load_module\n return load_source(name, filename, file)\n", " File \"/var/lang/lib/python3.8/imp.py\", li...
AWS Lambda is not a generic docker runner. The docker containers you deploy to Lambda have to comply with the AWS Lambda runtime environment.The docker image you are using is trying to write to the path/home/sbx_user1051apparently. On AWS Lambda the file system is always read-only except for the/tmppath. You will have ...
Docker user cannot write to mounted folder
I have the following setup:selenium-chrome: image: selenium/node-chrome-debug:3.141.59-neon container_name: chrome-e2e depends_on: - selenium-hub environment: - HUB_HOST=selenium-hub - HUB_PORT=4444 - SHM-SIZE=2g - GRID_DEBUG=false - NODE_MAX_SESSION=1 - NODE_MA...
Bind mounts in Linux do not perform any namespacing on the uid or gid, and host mounts are running a bind mount under the covers. So if the uid inside the container is different from the uid on the host, you'll get permission issues. I've worked around this in other containers with a fix-perms script. Implementing that...
Emulating `docker run` using the golang docker API
How can I achieve the equivalent ofsudo docker run -it --rm --name my-python-container -v "$PWD":/usr/src/myapp -w /usr/src/myapp python:2-slim python test.pyusing the Docker API for Golang?Eitherhttps://github.com/fsouza/go-dockerclientorhttps://github.com/samalba/dockerclientis fine.
Usinggithub.com/fsouza/go-dockerclient, you have to firstcreate a container, using theCreateContainerOptionsto add the same options that you can via the command line.container, err := client.CreateContainer(createContainerOptions)Once you have the container, youstart it, with any extra options or overrides in theHostCo...
Docker native Windows support?
I have a hard time finding information about this. Somewhere I've seen news that Docker has now natively been integrated to Windows. So apparently this means they are not "Linux container" but some kind of "Windows containers"? Does anyone have more information on this?
I have read this:https://azure.microsoft.com/blog/2015/04/16/docker-client-for-windows-is-now-available/As you can read there is only interface to manage docker containers inside Linux so far.
how to turn bash command into docker(-compose) healthcheck
I'm usingsath89/oracle-12cfor automated tests against a oracle db. This works fine, the only problem is that this container takes several minutes to start (~10-15 depending on the hardware). I tried to come up with a healthcheck for this container.I managed to come up withstatus=`su oracle -c "echo -e \"SELECT ACCOUNT_...
Okay, so after quite some time I've come up with an solution for my problem. I could simplify the "" a bit:version: '2.1' services: db: image: sath89/oracle-12c:r1 healthcheck: test: ["CMD-SHELL", "if [ \"`echo \\\"SELECT ACCOUNT_STATUS FROM DBA_USERS WHERE USERNAME = 'ANONYMOUS' AND ACCOUNT_STATUS = 'E...
How to enable HTTPS on Tomcat in a Docker Container?
I'm new to Tomcat and Docker, and am stuck trying to enable https on my website. First on the server, not in any container:a) I generated a CSRb) Acquired a commercial SSL certificatec) Placed the certificates in a folder on the server /etc/docker/certsd) Then created my Docker containers with the configuration belowI ...
You can map the external certs into a container atdocker runtime usingbind mounts. Assuming your certs are in/etc/docker/certson the host, and you want them to be at/etc/ssl/certsin the container, then add either of the following:-v /etc/docker/certs:/etc/ssl/certs:roor--mount type=bind,src=/etc/docker/certs,dst=/etc/s...