Prompt
stringlengths
14
160
Instruction
stringlengths
18
2k
Response
stringlengths
8
2k
pip install git+url within a docker environment
I am using this Docker (FROM lambci/lambda:python3.6) and I need to install a private repository package. The problem is the Docker does not have git and I can not install git using apt-get or apk install because the Docker is not Linux.Is there any possible way to fix this installing git? Or is there any other better ...
add this to makefile:# makefile git clone REPO cd REPO_DIR; python setup.py bdist_wheel cp REPO_DIR/dist/* . rm -rf REPO_DIR/add this to dockerfile:# dockerfile RUN pip install REPO*.whland then the package is successfully installed within docker
How to define OpenJDK 8 in CentOS based Dockerfile?
Assuming that there is a CentOS Dockerfile:FROM centosWhat is the right way of adding OpenJDK 8 for it ?I have tried to use similar approach as for Fedorahttps://github.com/projectatomic/docker-fedora-images/blob/master/java-openjdk-8/DockerfileBut when I run the image java version is"1.7.0_111", even though it is expe...
Seems to be as easy as this:FROM centos RUN yum install -y \ java-1.8.0-openjdk \ java-1.8.0-openjdk-devel ENV JAVA_HOME /etc/alternatives/jre . .
How can I enable MySQL binary logging using the official Docker image?
What would be the best way to enable binary logging using the official mysql image?I have tried using the mysql:5.7 image, overriding the command when running it to also pass through the startup options to enable binary logging to mysqld (see below). The problem with this approach is that the mysql user does not have p...
The problem with this approach is that the mysql user does not have permission to write to the /var/log/mysql directoryThe problem actually is that the directory/var/log/mysqldoes not exists on themysql:5.7Docker image. You can make sure of it running the following container:$ docker run --rm mysql:5.7 ls /var/log/ alt...
Docker Compose hostname command not working
I'm unable to get the Docker Composehostnamecommand to work.I'm running a simpledocker-compose.yml:version: '3' services: redis1: image: "redis:alpine" hostname: redis1host redis2: image: "redis:alpine" hostname: redis2hostOnce I run this withdocker-compose up, I should be able to rundocker-compose ...
Thehostnamedirective simply sets the hostname inside the container (that is, the name you get back in response to thehostnameoruname -ncommands). It does not result in a DNS alias for the service. For that, you want thealiasesdirective. Since that directive is per-network, you need to be explicit about networks rather...
Unable to change directories while building docker Image using Dockerfile
I am trying to create an Image from the Dockerfile.# cat Dockerfile FROM ubuntu:16.04 COPY $pwd/intel_virtual_gateway_console64_1_9_0.tar /root/ COPY $pwd/login.exp /root/ RUN cd /root RUN echo $PWD RUN tar -xvf intel_virtual_gateway_console64_1_9_0.tar RUN cd virtualgatewayconsole_package RUN apt-get update && apt-g...
use WORKDIRhttps://docs.docker.com/engine/reference/builder/#workdiror do all in one RUNyourcdis "forgotten" when you are in another RUNBy the way, group your RUN, as indicated in the Dockerfile best practiceshttps://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
Customize docker container bash
I try to set a custom configuration for Docker container bash prompt to display the git branch name when connected.I found everything to make it properly, but I fail to execute the~/.profileor even~/.bash_profilefiles at container's building.If I performsource ~/.profilemanually inside the container, it works fine. But...
I'm not sure using the ~/.profile configuration file is the best way to do what you want. Also, usingRUN source /root/.profilewon't have any effect since the line will be executed once only and won't be persistent when trying to execute the bash binary inside de container. (It will actually run a new bash session).So.....
Error executing docker-compose: Building webserver unable to prepare context: unable to 'git clone' to temporary context directory: error fetching
I'm followingthisApache Airflow tutorial and I'm failing to executedocker-compose up -dcommand. I get following error:Building webserver unable to prepare context: unable to 'git clone' to temporary context directory: error fetching: /usr/lib/git-core/git-remote-https: /tmp/_MEItH0v3Q/libcrypto.so.1.1: version `OPENSSL...
I had the same issue. Apparently this is a known bug for docker-compose 1.29 and Ubuntu 20 [1]Mydocker-composewasinstalled using curl.What worked for me was removingdocker-composeand install it using pip instead:sudo rm /usr/local/bin/docker-compose pip3 install docker-composeAfter that everything worked as expected.Th...
Dockerfile returns npm not found on build
I'm really new to Docker and would like to create a container that has all my Ruby on Rails website and its dependencies in it. I read TONS of documentations and how-to's to do it but I keep struggling.Since I use Rubymine, there is a built-in tool that allows you to Dockerize the current project you're in from the Doc...
You need to explicitly install node / npm in your container before running npm install. Add this to your Dockerfile.RUN apt-get update && apt-get install -y curl RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - RUN apt-get update && apt-get install -y nodejs
Is swarm required for using multi-host networking feature using overlay in docker
I have followed through the example atgetting started overlayand i have a simple query. Is it possible to use multi-host networking feature using overlay without creating aswarm cluster? I don't want to use third party plugins like weave etc. I want to use docker native networking support for this.I have3.16+ kernelrun...
Yes, it is possible: see "Lab 6: Docker Networking".The key part of an overlay network is the discovery service, like for instanceConsul.An overlay network requires a key-value store.The store maintains information about the network state which includes discovery, networks, endpoints, ip-addresses, and more. Engine sup...
How to link from docker-compose to Amazon RDS
My docker-compose.yml looks something like this:django: build: . user: django links: # LINK TO AMAZON RDS? command: /gunicorn.sh env_file: config/settings/.env nginx: build: ./compose/nginx links: - django ports: - "0.0.0.0:80:80"How do I link the django container to the Amazon RDS, which h...
In that case, you don't have to define a "link"; the database service is already running, so all you need to do, is configure your django app to connect to that host.I don't have experience with django, but based on theexample in the docker-compose documentation, it would look something like;DATABASES = { 'default'...
How to install docker 1.9+ in CentOS 6.5?
I'm now deploying on CentOS 6.5, and I'm now starting to use docker.So, I follow the instructions on:https://docs.docker.com/engine/installation/centos/No matter which method I follow to install, I get version of1.7.1.[root@VM_72_235_centos ~]# docker version Client version: 1.7.1 Client API version: 1.19 Go version (c...
CentOS 6 and RHEL 6 are no longer supported, and the last build for them is docker 1.7.1.That page of the documentation (https://docs.docker.com/engine/installation/centos/) also mentions;Docker runs on CentOS 7.X Docker requires a 64-bit installation regardless of your CentOS version. Also, your kernel must be 3.10 ...
Docker-Compose Persistent Data Trouble
I'm having trouble in configuring persistent data withMariadb. I'm usingdocker-compose, with each service in a single container (Nginx,PHP-FPMandMariadb). Everything is working, exceptMariadbdoesn't store data. Every time I restart the container, I lose all the data. Then I found out that I can use another container ju...
The way i do it is that I use busybox for all data stored and shared with mariadb. Then use--volumes-fromin mariadb to link that directories. Please have a look into my simpifiedcompose.ymlfile.db-data: container_name: db-data image: busybox:latest volumes: - /data/mysql:/var/lib/mysql db: container_name: ...
making requests to localhost from inside docker container
I have an application runing on my localhost at port 8080. I have some python code that consumes that service. The code runs fine on my base system but as soon as I put it inside a docker container I geturllib2.URLError: . I have another application that exposes an api at port 6543. Same problem.I assume I need to tel...
Create your python container with argument-net host,it will share address and port with host,so it can access progress which is running on host.Refer to my another answer:https://stackoverflow.com/a/48069763/5465023
can not use user-defined bridge in swarm compose yaml file
I learned fromdocker documentationthat I can not use docker DNS to find containers using their hostnames without utilizing user-defined bridge network. I created one using the command:docker network create --driver=overlay --subnet=172.22.0.0/16 --gateway=172.22.0.1 user_defined_overlayand tried to deploy a container t...
As of 17.06, you can create node local networks with a swarm scope. Do so with the--scope=swarmoption, e.g.:docker network create --scope=swarm --driver=bridge \ --subnet=172.22.0.0/16 --gateway=172.22.0.1 user_defined_bridgeThen you can use this network with services and stacks defined in swarm mode. For more detail...
How to prevent docker from searching docker hub
I'm standing up a few docker hosts to run in a production environment. We want all of our images to have to go through our container pipeline and we do not want to be able to pull images from Docker Hub (security concerns).How can I stop docker being able to pull images from dockerhub? Ideally I would like to do this v...
I think it is not possible to prevent docker for searching docker hub..Butit is possibleto prevent/avoid pulling image from docker hub. And it this case, all searching on docker hub will find nothing.To do it: you must concatenate your private registry url(without https:// or http://) with your image name like:FROM myp...
Kubernetes. HTTPS API return `Unauthorized`
Kubernetes API requestcurl https://192.168.0.139 --cacert /home/mongeo/ku-certs/ca.pemreturnUnauthorizedRequestcurl localhost:8080worked good.My kube-proxy and kube-apiserver standart (coreos+k8s tutorial)How do I get data on HTTPS?
Did you specify--token-auth-file=and/or--basic-auth-file=or one of the other authentication modes? I don't know that https endpoint will work without one of these (maybe it should, but it doesn't, apparently). Check outhttps://kubernetes.io/docs/admin/authentication/
Parse a variable with the result of a command in DockerFile
I need to fill a variable in dockerfile with the result of a commandLike in bash var=$(date)EDIT 1date is a example. in my case i useFROM phusion/baseimage:0.9.17so i want at each building use the last version so i use thiscurl -v --silent api.github.com/repos/phusion/baseimage-docker/tags 2>&1 | grep -oh 'rel-.*",' | ...
I had same issue and found way to set environment variable as result of function by using RUN command in dockerfile.For example i need to set SECRET_KEY_BASE for Rails app just once without changing as would when i run:docker run -e SECRET_KEY_BASE="$(openssl rand -hex 64)"Instead it i write to Dockerfile string like:...
Referencing Docker container from server-side (from another container) AND from client-side (browser) with same URL
I have two docker containersfrontendanddata-service.frontendis using NextJS which is only relevant because NextJS has a method calledgetInitialProps()which can be run on the server, or can be run in the visitor's browser (I have no control over this).IngetInitialProps()I need to call an API to get the data for the page...
The most elegant solution I've found is described in this post:Docker-compose make 2 microservices (frontend+backend) communicate to each other with http requestsExample implementation:Innext.config.js:module.exports = { serverRuntimeConfig: { // Will only be available on the server side URI: 'your-docker-uri...
"ModuleNotFoundError: No module named <package>" in my Docker container
I'm trying to run a python script in a Docker container, and i don't know why, python can't find any of the python's module. I thaught it has something to do with the PYTHONPATH env variable, so i tried to add it in the Dockerfile like this :ENV PYTHONPATH $PYTHONPATHBut it didn't work. this is what my Dockerfile looks...
Inside the container, when Ipip install bugsnag, I get the following:root@af08af24a458:/app# pip install bugsnag Requirement already satisfied: bugsnag in /usr/local/lib/python2.7/dist-packages Requirement already satisfied: webob in /usr/local/lib/python2.7/dist-packages (from bugsnag) Requirement already satisfied: s...
Docker PHP with Xdebug 3 env XDEBUG_MODE doesn't work
I’m trying to configXdebug 3in PHP container, and setXDEBUG_MODEenv variable tooffaccording with documentationhttps://xdebug.org/docs/all_settings#modebutxdebug_info()shows thatmode=develop. How to fix?Dockerfile:FROM php:7.4.11-fpm … ENV XDEBUG_MODE=off ENV XDEBUG_CONFIG="" RUN pecl install xdebug \ && docker-php...
It actually works. I mean: the actual behaviour / final result.Despite the fact that it showsxdebug.mode => developthe actual features are ALL turned OFF:Feature => Enabled/Disabled Development Aids => ✘ disabled Coverage => ✘ disabled GC Stats => ✘ disabled Profiler => ✘ disabled Step Debugger => ✘ disabled Tracing =>...
docker is full, all inodes are used
got huge problem, all my inodes seems to be used. I've cleaned all volumes unused Cleaned all container and images with command -> docker prunebut still it seems that it stay full :Filesystem Inodes IUsed IFree IUse% Mounted on none 3200000 3198742 1258 100% / tmpfs 873942 16 873926...
Found the error, this seems to be Docker 17.06.1-ce error. This version seems not correctly deleting images, and keeping files in/var/lib/docker/aufs/mnt/So just upgrade to new docker version and this will be fine. now df show meFilesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 51558236 38216...
SIGTERM does not reach node script when docker runs it with `/bin/sh -c`
When my Dockerfile ends withCMD node .docker runs that container with the command/bin/sh -c "node ."instead of simplynode .(I know, I could do that withCMD ["node", "."]).I thought that this behavior is actually nice, since it means that inside the containerPID1is/bin/shand not my humble node script.If I understand cor...
There are tools designed to solve this problem:https://github.com/yelp/dumb-inithttps://github.com/krallin/tiniI think if you only have a single process, all you need to do is explicitly handle the signal with a signal handler, which bash doesn't do for you.Using the["node", "."]syntax, you could usehttps://nodejs.org/...
How to set mysql username in dockerfile
When installing mysql in ubuntu withapt-get install mysql-server, the mysql username and password are asked during the installation.But when using a dockerfile to build a mysql image, how can the username and password be provided?I tried using the dockerfile as follows:FROM ubuntu:14.04 apt-get update apt-get install -...
If you take a look at the official Docker MySQL imageDockerfile, you will discover how they did it usingdebconf-set-selections.The relevant instructions are:RUN { \ echo mysql-community-server mysql-community-server/data-dir select ''; \ echo mysql-community-server mysql-community-server/root-pass passw...
Docker - modifying IPTABLES for host from container
I want to run a docker container with central log andfail2banservice to prevent from dos/ddos attacks.I'm having a problem to run a container with such capabilities that it could also modify the hosts iptables.There is a projectianblenke/docker-fail2banhowever it does not work...Giving the container flag privileged onl...
Docker containers, by default, run inside an isolated network namespace where they do not have access to the host network configuration (including iptables).If you want your container to be able to modify the network configuration of the host, you need to pass the--net=hostoption todocker run. From thedocker-run(1)ma...
How does Docker run a command without invoking a command shell?
I'm learning about Docker at the moment, and going through theDockerfile reference, specifically theRUNinstruction. There are two forms ofRUN- theshellform, which runs the command in a shell, and theexecform, which "does not invoke a command shell" (quoted from theNotesection).If I understood the documentation correctl...
If I understand your question correctly, you're asking how something can be run (specifically in the context of docker) without invoking a command shell.The way things are run in the linux kernel are usually usingtheexecfamily of system calls.You pass it the path to the executable you want to run and the arguments that...
Shared Volume in Docker through Vagrant
I have a Vagrant virtualbox which hosts a Docker container. The host machine has a folder which needs to be accessible in the vm and the container:Host: /host/path => VM: /vagrant/path => Container: /docker/pathBackground:/host/path/holds the development files for a project which are available at container level to ens...
I had the same issues. The posted solutions didn't fit my requirements.Here is my solution. If you run more than one container iterate over the cids in/var/lib/vagrant/cids/The first script disables the docker-deamon container autostart at boot. The second script starts the container by its CID only if it isn't running...
Docker: cannot open port from container to host
I'm usingDocker for Mac. I have a container that run a server, for example my server is run on port 5000. I have exposed this port onDockerfileWhen my container is running, I connect to this container and check and if this server is working or not by running below command and see that it returns data (a bunch of html a...
Please check the program in container is listening on interface 0.0.0.0.In container, run command:ss -lntpIf it appears like:LISTEN 0 128 127.0.0.1:5000 *:*that means your web app only listen at localhost so container host cannot access to your web app. You should make your server listen at0.0.0.0interface by cha...
Http Trigger Azure Function in Docker with non anonymous authLevel
I am playing around with an Http Triggered Azure Functions in a Docker container. Up to now all tutorials and guides I found on setting this up configure the Azure Function with theauthLevel"set toanonymous.After readingthis blogcarefully it seems possible (although tricky) to also configure other authentication levels...
To control the master key the Function host uses on startup - instead of generating random keys - prepare our ownhost_secrets.jsonfile like{ "masterKey": { "name": "master", "value": "asGmO6TCW/t42krL9CljNod3uG9aji4mJsQ7==", "encrypted": false }, "functionKeys": [{ "name": "d...
Send email on testing docker container with php and sendmail
I'm on ubuntu 16.04. I have a (testing) docker (docker-compose) container running php 5.6 and apache 2.4.On the production platform (without docker) the mail is sent with sendmail.How to send test email on docker container (with sendmail)?Thanks in advance for responses.
It works.In Dockerfile :# sendmail config ############################################ RUN apt-get install -q -y ssmtp mailutils # root is the person who gets all mail for userids < 1000 RUN echo "[email protected]" >> /etc/ssmtp/ssmtp.conf # Here is the gmail configuration (or change it to your private smtp server)...
How to run livereload with gulp within a docker container?
I created a docker container to run tasks with gulp. All tasks are running, the problem is I can't enable livrereload in Chrome although I exposed the 35729 port in my container.Here is the Dockerfile :FROM ubuntu:latest MAINTAINER jiboulex EXPOSE 80 8080 3000 35729 RUN apt-get update RUN apt-get install curl -y RUN ...
Exposing ports in a container does not imply that the ports will be opened on the docker host. You should be using thedocker run-poption. The documentation says:-p=[] :Publish a container᾿s port or a range of ports to the hostformat:ip:hostPort:containerPort|ip::containerPort|hostPort:containerPort|containerPortBo...
How to clear Docker task history
When running docker in swarm mode, a history of past tasks accumulate as docker services are updated. Runningdocker node psdisplays the log of tasks.How do I clear this log without removing the service?
You can adjust the history limit in swarm by running:docker swarm update --task-history-limit=1Which will only keep one previous task instead of the default 5. See the cli docs for more details:https://docs.docker.com/engine/reference/commandline/swarm_update/
Docker container not able to connect to remote MongoDB
I have aflaskbased python code which simply connects tomongodb.It has two routesGetPost.Getsimply printshello worldand usingPostwe can post any json data which is later saved inMongoDBThis python code is working fine.MongoDBis hosted on cloud.I have now created a Dockerfile:FROM tiangolo/uwsgi-nginx-flask:python3.6-alp...
You probably don't have internet connection from the container. I had a similar issue when connecting from containerized java application to public web service.At first I would try to restart docker:systemctl restart dockerIf it does not help then look into resolv.conf in you container:docker run --rm myflaskimage cat ...
Push to google container registry fails: Retrying
I'm trying to push to the Google container registry from my Jenkins. The builds run inside the Kubernetes Jenkins Plugin, which uses the gcr.io/cloud-solutions-images/jenkins-k8s-slave to build the docker image into the Kubernetes native Docker.After authenticating to the Google container registry I'm trying to push th...
The root cause of this issue is that your docker daemon is not authenticated with the credentials necessary to push to gcr.io. For the original question, I believe this is likely because the user account being used was_tokeninstead ofoauth2accesstoken.I was experiencing an error similar to this, except that instead of...
How to Containerize a Vue.js app?
I am unable to access the site locally on thehttp://172.17.0.2:8080/in Chrome, I get "172.17.0.2 took too long to respond".I used the inspect command to obtain the IP address of the container.docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} e83c95d05d63The run command that I used.docker run -...
In a default vue-cli setup,npm start(the command you are using) runsnpm run dev.And, again, by default,npm run devbinds to localhost only.Add--host 0.0.0.0to yourwebpack-dev-serverline inpackage.jsonso you can access it fromoutsidethe docker container:From something like:"scripts": { "dev": "webpack-dev-server --in...
How to use local Docker image with docker-compose?
I have a docker-compose file and want to be able to make one of the images be spun up from the image in my local cache vs. pulling from dockerhub. I'm using the sbt docker plugin, so I can see the image being created, and can see it when I dodocker imagesat the command line. Yet, when I dodocker-compose up -d myimage...
You can force using the local image by retaging the existing image:docker tag remote/image local_imageAnd then inside the compose file usinglocal_imageinstead ofremote/image.
Wrong permissions in volume in Docker container
I run Docker 1.8.1 in OSX 10.11 via an local docker-machine VM.I have the following docker-compose.yml:web: build: docker/web ports: - 80:80 - 8080:8080 volumes: - $PWD/cms:/srv/cmsMy Dockerfile looks like this:FROM alpine # install nginx and php RUN apk add --update \ nginx \ ...
1)General idea: Docker it is not Vagrant. It is wrong to put two different services into one container! Split it into two different images and link them together. Don't do this shitty image.Check and followhttps://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/Avoid installing unnecessary packages...
Docker for golang application
i've golang application which I want to build docker image for it the application folder calledcloud-native-goand the dockerfile is under the root project Any idea what is wrong here ?FROM golang:alpine3.7 WORKDIR /go/src/app COPY . . RUN apk add --no-cache git RUN go-wrapper download # "go get -d -v ./..." RUN go-wr...
go-wrapperhas been deprecated and removed from the images usinggoversion 10 and above. Seehere.If you are fine usinggo v1.9you can use the following image:golang:1.9.6-alpine3.7.So yourDockerfilewill be:FROM golang:1.9.6-alpine3.7 WORKDIR /go/src/app COPY . . RUN apk add --no-cache git RUN go-wrapper download # "go g...
Setting Up Docker Dnsmasq
I'm trying to set up a docker dnsmasq container so that I can have all my docker containers look up the domain names rather than having hard-coded IPs (if they are on the same host). This fixes an issue with the fact thatone cannot alter the /etc/hosts file in dockercontainers, and this allows me to easily update all m...
The build script for the docker dnsmasq service needs to be changed in order tobind to your server's public IP, which in this case is 192.168.1.12 on my eth0 interface#!/bin/bash NIC="eth0" name="dnsmasq_" timenow=$(date +%s) name="$name$timenow" MY_IP=$(ifconfig $NIC | grep 'inet addr:'| grep -v '127.0.0.1' | cut -...
How does VSCode [Remote Development] [Forward Port] work?
When using VSCodeRemote DevelopmentOpen Folder in Containerto develop in docker container in Mac, I can not find:Any info about the port bydocker inspect containerIdAny port config in DockerfileBut I can still access the service in container from host browser.
VS Code uses SSH Tunnel to connect to remote machine. The port forwarding is simply creating this tunnel. You can do it without vscode with the command below if you have ssh client installed. You have to run this command from localhost shell prompt. (I assumed we want to connect to port 8080 on remote-machine using loc...
Private Docker Registry: 'x509: certificate signed by unknown authority' only for Windows images
While trying to pull Windows images from a Private Docker Registry, I'm getting the following errorx509: certificate signed by unknown authorityI've installed the proper certificate and I can pull Linux images without any issue, but for some reason I'm unable to pull Windows ones.My co-workers don't have this problem.A...
To add an insecure docker registry, add the file/etc/docker/daemon.json(in Linux) with the following content:{ "insecure-registries" : [ "your.registry.host:5000" ] }and then you need to restart docker.In case of Windows the file is at the following path:C:\ProgramData\docker\config\daemon.json
Docker volume vs Kubernetes persistent volume for databases
Both Docker images & Kubernetes clusters have mechanisms to configure persistent storage on the host machine, a separate container, or just some form of cloud/network storage mechanism.I'm trying to understand how they are different in use cases and why you'd use one over the other. For context, I'm also looking at thi...
using docker volumes on a cluster like Kubernetes gives you no data persistency. The workload can get scheduled on different node and you're done. To provide persistent storage in K8S cluster you need to use K8S solution to the problem.
Using Docker with nodejs with node-gyp dependencies
I'm planning to use Docker to deploy a node.js app. The app has several dependencies that require node-gyp. Node-gyp builds these modules (e.g. canvas, lwip, qrcode) against compiled libraries on the delivery platform, and in my experience these builds can be highly dependent on the o/s version and libraries installe...
How can I ensure the target host will have the libraries needed to compile the node-gyp modules?The target host is running docker as well. As long as the dependencies are in your image then your server has them as well. That's the entire point with docker if you ask me. If it runs locally, then it runs on the server as...
How to install kerberos client in docker?
I am trying to createDockerimage by nextDockerfile. It must to installKerberosclient.Dockerfile:FROM node:latest RUN export DEBIAN_FRONTEND=noninteractive RUN apt-get -qq update RUN apt-get -qq install krb5-user libpam-krb5 RUN apt-get -qq clean COPY / ./ EXPOSE 3000 CMD ["npm", "start"]Next commandRUN apt-get -qq...
You need the-yparameter for the aptFROM node:latest ENV DEBIAN_FRONTEND=noninteractive RUN apt-get -qq update && \ apt-get -yqq install krb5-user libpam-krb5 && \ apt-get -yqq clean COPY / ./ EXPOSE 3000 CMD ["npm", "start"]And pay attention, that eachRUNdirective creates one additional layer in the image....
No module named amazon_linux_extras when running amazon-linux-extras install epel -y
Here is my (simplified) Dockerfile# https://docs.aws.amazon.com/lambda/latest/dg/images-create.html#images-create-from-base FROM public.ecr.aws/lambda/python:3.8 # get the amazon linux extras RUN yum install -y amazon-linux-extras RUN amazon-linux-extras install epel -yWhen it reaches theRUN amazon-linux-extras insta...
You're correct, it's becauseamazon-linux-extrasonly works with Python 2. You can modify theRUNinstruction toRUN PYTHON=python2 amazon-linux-extras install epel -y
How do I setup only python 2.7 in a docker container?
I have node app and in one use case I am calling python script from node usingpython-shell. I am trying to setup this app on docker and my Dockerfile looks something like this:FROM debian:latest # replace shell with bash so we can source files RUN rm /bin/sh && ln -s /bin/bash /bin/sh # update the repository sources li...
You can use python base imageFROM python:2.7This base image with have python pre-configured and you don't need to install python seperately. Hope it helps.Here is thelistof available imageFor quick reference please checkhttps://blog.realkinetic.com/building-minimal-docker-containers-for-python-applications-37d0272c52f3
Trying to build a docker container, start.sh not found
I'm trying to build a docker container, but it doesn't seem to find my start.sh. It copies it to the container, but it somehow doesnt work.This is my dockerfile:FROM ubuntu:16.04 # Install Meteor RUN apt-get update RUN apt-get install -y curl RUN curl https://install.meteor.com/ | sh RUN meteor npm install --save high...
Turns out there wasn't anything wrong with my files. I created a new directory on my pc, created new files and copied the contents of the start.sh and Dockerfile and my app there. The error was gone. This has to be some serious bug, my friend just got the same error with other files that work on my pc as well.Maybe som...
How to get docker0 ip address platform independently
I'm building application which needs to have ip address of docker0 without using commands likeip addr show dev docker0. Is there any way to get it from docker itself maybe usingdockercommand or something else? At least thedocker infodoesn't seem to show it.
docker0network interface is associated with the defaultdocker networkbridge.You can access info about it with thedocker network inspect bridge.You can use the--formatoption to get specific value:$ docker network inspect bridge --format='{{json .IPAM.Config}}' [{"Subnet":"172.17.0.0/16","Gateway":"172.17.0.1"}]
Prometheus - how to monitor other docker containers
I want to usePrometheusto monitor mydockercontainers. I can runPrometheuswithGrafanabut I do not know how to instruct it to monitor other docker containers. If possible I would like to see some example. For instance I haveUbuntucontainer running on my host as well asGentoocontainer. How can I tell Prometheus to monitor...
You could usecadvisor, which provides container users an understanding of the resource usage and performance characteristics of their running containers.Avery good articleabout setting upPrometheusto monitorDockeris using this architecture:Briefly, the idea is to collect information about containers usingcAdvisorand pu...
Mounting Maven Repository to Docker
I am trying to build a Java application and make a package using docker. This builds needs a maven repository which I don't want to include in the image, since it's very large. I wanted to try using volumes and mount my local maven repository to the maven repository in the image. I usedapt-get install -y mavenin order ...
I finally found the solution for mounting my local maven repository in docker. I changed my solution; I am mounting it in therunphase instead ofbuildphase. This is myDockerfile:FROM ubuntu MAINTAINER Zeinab Abbasimazar ADD gwr $HOME RUN apt-get update; \ apt-get install -y --no-install-recommends apt-utils; \ a...
Nuget package restore error in Docker Compose build
I am getting nugget restore error while building using docker-compose behind proxy. I have set proxy in docker for windows. Nuget restore works for command linedotnet restoreand visual studio debug, but not usingdocker-compose.:\Program Files\dotnet\sdk\2.1.104\NuGet.targets(104,5): error : Unable to load the service i...
SOLVED:It turns out to be a networking issue. I am behind a corporate firewall at work that leverages TLS packet inspection to break apart SSL traffic. The build process while debugging runs as "me" on my local machine, however, the release build (docker-compose) actually pulls down a aspnetcore-build docker image, co...
Node in Docker: npm test and exit
I want to test my node docker image with "npm run test" as a command overwrite when running my container.My Dockerfile is:FROM node:alpine WORKDIR /app COPY ./package.json ./ RUN npm install COPY ./ ./ CMD ["npm", "run", "start"]The "npm run test" command should be run in my container and exit to the terminal (locally ...
Found that the docker run command should contain -e CI=trueto exit immediately:docker run -e CI=true myimage npm run testFrom React documentation about "CI=true":The test command will force Test to run in CI-mode, and tests will only run once instead of launching the watcher.
Using linked container environment variables in application environment?
I have an application which uses an environment variable namedREDIS_URL. A typicalREDIS_URLwould beredis://172.17.0.5:6379/0. I'd like to be able to populateREDIS_URLbased on container linking:docker run --name redis -d redis docker run --name firehose --link redis:redis -e REDIS_URL="redis://$REDIS_PORT_6379_TCP_ADDR:...
The$REDIS_PORT_6379_TCP_ADDRand$REDIS_PORT_6379_TCP_PORTvariables are not known at the time thedocker runcommand is executed so there's no way to construct it from the host.However, there is a workaround. In theDockerfilefor thefirehose/serverimage there must be aCMDorENTRYPOINTthat dictates what command is executed wh...
Docker Build can't find pip
Trying to follow a few[1][2] simple Docker tutorials via AWS am and getting the following error:> docker build -t my-app-image . Sending build context to Docker daemon 94.49 MB Step 1 : FROM amazon/aws-eb-python:3.4.2-onbuild-3.5.1 # Executing 2 build triggers... Step 1 : ADD . ...
Something is very odd here. Why do you have the virtualenv content next to your Dockerfile?The image you are building fromcreates the virtualenv on /var/app (within the container, yes?) for you. I believe that the ONBUILD command copies it (or parts of it) over and corrupt the rest of the process, making the /var/app/b...
Spring boot is consuming too much RAM
I have created some services in spring boot, I have 11 fat jars and I deploy them in docker containers, my doubt was that every jar was consuming between 1 and 1.5 GB of RAM without any use, I check the RAM by running:docker stats containernameAt first I thought that it was the java container and I tried to change to o...
You can set memory usage of docker container using-e JAVA_OPTS="-Xmx64M -Xms64M".docker file:FROM openjdk:8-jre-alpine VOLUME ./mysql:/var/lib/mysql ADD /build/libs/application.jar app.jar ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jarimage run:docker run -d --name container-name ...
How to check if the restart policy works of Docker
From the Dockerdocument, there is arestart policyparameter could be set.How do I verify the container indeed restarts when the container exits. How to trigger the exit of container manually, and observe if the container restarts?My environment is Mac and boot2docker.Thanks
you can alsodocker exec -it container_id bashand thenkill -9of the main process. I tested withdocker run -d --restart=always -e DISPLAY=$DISPLAY -v /home/gg/moncontainer:/home/gg -v /tmp/.X11-unix:/tmp/.X11-unix k3ck3c/captvtyI killed the main process (pid 5, Captvty.exe), was logged out of the container, and 2 seconds...
docker-compose containers uses wrong container with multiple projects
I have two projects and I need two differents docker environnement (containers). I have twodocker-compose.ymlfiles in two different projects.fooproject andbarproject.foo/src/website/docker-compose.yml#1 (foo)version: '3' services: db: env_file: .env image: mariadb:10.0.23 container_name: foo-db ports:...
Yes, the directory name is the default project name fordocker-compose:$ docker-compose --help ... -p, --project-name NAME Specify an alternate project name (default: directory name)Use the-pargument to specify a particular non-default project name.Alternatively, you can also set theCOMPOSE_PROJECT_NAMEenvironmen...
Does docker reuse images when multiple containers run on the same host?
My understanding is that Docker creates an image layer at every stage of a dockerfile.If I have X containers running on the same machine (where X >=2) and every container has a common underlying image layer (ie. debian), will docker keep only one copy of the base image on that machine, or does it have multiple copies f...
DockersUnderstand images, containers, and storage driversdetails most of this.From Docker 1.10 onwards, all the layers that make up an image have an SHA256 secure content hash associated with them at build time. This hash is consistent across hosts and builds, as long as the content of the layer is the same.If any numb...
Active directory accounts inside a windows container (server 2016 TP5)
So I have Windows Server 2016 TP5 and I'm playing around with the containers. I am able to do basic docker tasks fine. I'm trying to figure out how to containerize some of our IIS-hosted web applications.Thing is, we usually use integrated authentication for the DB and use domain service accounts for the app pool. I cu...
Update: this answer is no longer relevant - was for 2016 TP5. AD support has been added in later releasesOriginal answerQuick answer - no, containers are not supported as part of AD so you can't use AD accounts to run processes within a container or authenticate with itThis used to be mentioned on the MS Containers sit...
Dockerfile FROM Instruction
TheDockerfile referencesays the following about the FROM instruction:FROMcan appear multiple times within a singleDockerfilein order to create multiple images. Simply make a note of the last image ID output by the commit before each newFROMcommand.I don't understand what they mean bynote the last image ID output by the...
#Note: image1 and image2 can be same FROM image1 .. any commands for image1 FROM image2 .. any commands for image2It will create two images. It will return latest image id after the build(as the doc says). So this usage is possible(I didn't see that usage yet.), but in my opinion it can be used on exceptional cases. I...
docker-compose yaml - option to pass the 'ulimit' parameters 'rtprio' and 'memlock'
I can't find the option in the docker-compose.yaml to pass the parameters the following 'docker' parameters:--ulimit rtprio=95 --ulimit memlock=-1In other words, I wish to wrap the following command with docker-compose:docker run --rm -it --network host --ulimit rtprio=95 --ulimit memlock=-1 --name my_proj image/my_ima...
There's a per-service dictionary calledulimits:.version: '3' services: my_proj: image: image/my_image ulimits: rtprio: 95 memlock: -1 ...Note that Docker Compose works better with non-interactive services that stay running; I would use it to launch your service proper and not necessarily to ge...
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? Linux Bash Shell on windows 10
I am new to Docker. I'm trying to work with it on windows. I have Windows 10 Family so I installed Linux Bash Shell. When I run this command:$ docker run hello-worldI get :docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. And when I run$ systemctl status docker...
It seems like you wont be able to use docker in Windows 10family, since docker Desktop requires specific Windows version, as said inofficial documentation.System RequirementsWindows 10 64-bit: Pro, Enterprise, or Education (Build 15063 or later).What you can try is to run linux-based virtual machine on you Windows host...
The "code" command does not work when connecting to a Docker container remotely with VSCode
I am using VSCode in my local PC and connecting to a Docker container in a remote server with VSCode's Extensions ofRemote - SSHandRemote - containers. However, when I type$ code on the VSCode's terminal (Bash), I get an error messages saying thatbash: code: command not foundand I can't edit the file on the VSCode's ed...
I'll answer myself as I was able to call VSCode using thecodecommand in the remote's container.When I look closely underneath home, I see that there was acodeat the following directory.$HOME/.vscode-server/bin//bin/So I passed the PATH through it and it worked.By the way,is a directory with a hash-like name, which is r...
NodeJS Mongodb in docker compose = ECONNREFUSED
I try to up a Node.JS container linked with a MongoDB container by docker-compose, but systematically node.js return an ECONNREFUSED error.The errornodejs_1 | /code/node_modules/mongoose/node_modules/mongodb/lib/server.js:228 nodejs_1 | process.nextTick(function() { throw err; }) nodejs_1 | ...
I solve my problem:I try to setup my connection (from node) to mongodb before the mongodb server was completely up (it take 5/6 secs for the first start).So, i just need to retry the connection few times (3/4 times) with 1 sec before each requests from node before mongo accept the request.var connectWithRetry = functio...
Docker Compose build context from git repository with Dockerfile inside folder
I would like to build a new image in my docker compose project using a git repository as I need to change some ARG vars.My concern is that the Dockerfile is inside a folder of the git repository.How can be specified a folder as build context using a git repository?Repository:https://github.com/wodby/drupal-php/blob/mas...
It should be this way: myrepo.git#:myfolderversion: "2" services: php: build: context: https://github.com/wodby/drupal-php.git#:7 args: - BASE_IMAGE_TAG=7.1 - WODBY_USER_ID=117 - WODBY_GROUP_ID=111 volumes: - ./:/var/www/htmlhttps://docs.docker.com/engine/ref...
.jar file not found when building a Docker container with Palantir Gradle plug-in
If I try to build a Docker container with a Spring Boot application under Windows 10, I get the following error:> Task :docker FAILED COPY failed: stat /var/lib/docker/tmp/docker-builder711841135/myproject.jar: no such file or directoryI'm using Docker Community Edition in version 18.03.0-ce-win59 (16762) and Gradle 4....
The problem is theCOPYcommand in the Docker file:COPY build/libs/myproject.jar myproject.jarThe source directorybuild/libs/is not where the files for building the Docker container reside. Instead the directorybuild/docker/is used as Docker build context. WhenCOPYis executed this directory is the effective working direc...
What will happen after the maximum number of images pushed to ECR repository
According toAmazon ECR Service Limits, the maximum number of images per repository is 1,000. After exceeding this limit, the oldest image won't remove automatically. It blocks pushing to the repository. So I have to clean old images manually.Update:AWS introducedECR Lifecycle Policies. We can now automate the cleanup w...
Having experienced this exact scenario, I can confirm that upon reaching the limit, AWS will block you from pushing with this very unhelpful error message:Error pushing to registry: Server error: 403 trying to push : manifestYou'll need to manage the number of repositories yourself. As there is currently no built in g...
Access localhost from docker container
I have an assignment to set up 3 docker container on localhost:8081, localhost:8082 and localhost:8083 which i've done succesfully.Then there is a last container that is a java app on localhost:8080 and it needs to send requests using HttpClient and HttpRequest to the other containers i've done this creating a bridge w...
On Linux containers, your can access the host using IP address172.17.0.1. So from inside your Java app you should be able to reach the other containers on172.17.0.1:8081,172.17.0.1:8082and172.17.0.1:8083. That's equivalent to usinglocalhost:8081,localhost:8082andlocalhost:8083on your host machine.
How to set-up a docker registry acting as a Proxy?
I have a server (let's name it A) which may have access to internet and from which I'm able to pull images from the officiel docker.io registry.I also have other servers (B, C) which cannot have this same access for security reasons, but are allowed to have access to A.I also have decided to install a private registry ...
Step 1: Run registry version 2+ with proxy configurationYou need to run docker registry with aproxyconfiguraiton.To get an initialconfig.yml:docker run -it --rm --entrypoint cat registry:2 /etc/docker/registry/config.yml > `pwd`/config.ymlAdd following toconfig.yml:proxy: remoteurl: https://registry-1.docker.ioTh...
How to autogenerate and apply migrations with alembic when the database runs in a container?
I find the workflow for working with database migrations in a containerized environment confusing. I have a web API with an attached database. The API runs in one container and the database in another. The project file structure is as follows. ├── docker-compose.yml ├── Dockerfile └── app | ├── __init__.py | ├── ...
Since your database has publishedports:, you can access it directly from the host. The application running outside a container on the host and the same application running in a Compose setup are different environments, and it's appropriate to use environment variables to specify this. Do not hard-code a database loca...
How to install specific version of Docker on Centos?
I tried to install docker 1.8.2 on Centos7. The docs don't tell anything about versioning. Someone who can help me? I triedwget -qO- https://get.docker.com/ | sed 's/lxc-docker/lxc-docker-1.8.2/' | sh + sh -c 'sleep 3; yum -y -q install docker-engine'but didn't work.EDIT:I performed:yum install -y http://yum.dockerproj...
So you can use this command to check which versions are in the yum repo:sudo yum list docker-engine.x86_64 --showduplicates | sort -rand then use this to install the version listed that you want:sudo yum -y install docker-engine-If you simply want to downgrade the docker package (this can be performed multiple times, b...
Docker "Sharing Dependencies"
Along with the readings with Docker, I stopped a couple of times with the fact that Docker containers not only share the host kernel, but If possible they share common binaries and libraries.What I understand from that, is that If I'm running the same docker Image twice on the same host, and this image is using some fi...
Yes, answer is "true" to both questions. If you start 2 (or more) containers on the same host, all using the same base image, the whole content of the base image will be shared.What is called as an "image" is, in fact, multiple images called "layers" with parent-child relationships, stacked together.Now, If you start m...
How does containerization software like Docker translate CPU instructions?
I recently ran into a bug where a python library used a certain CPU instruction which existed on one x86 processor but not on another, resulting in an unexpected crash of the program (Illegal instruction) on one system but not on another. That had me thinking of the benefits of containerization to create a well-defined...
Containers don't translate instructions. A program running in a container is exactly the same as any other program running on the same machine, except that it has separate ("namespaced") instances of certain things, like the filesystem, the network stack, and the system hostname. The CPU isn't emulated or virtualized (...
Docker - Container cannot be connected to network endpoints
I am getting the following error when running a contaner by attaching to network interfaces test-net, sample-net,bridge0 . My requirement is to have a container that connects to different containers those are in different networks.docker network create --driver bridge sample-net docker container run --name c3 -d -...
It doesnt seem possible to start a container by connecting to multiple networks at once.From the pagehttps://success.docker.com/article/multiple-docker-networksDocker only allows a single network to be specified with the docker run command. To connect multiple networks "docker network connect" is used to connect additi...
docker: set running user while launch container
I use the official golang docker image to compile my go program and put the resulting executable on a volume mapped to my host directory.The problem is that file generated by docker belongs to root:root, which is very annoying because I do not want to run my script via sudo.I searched for solutions to make docker conta...
which I made by base alphine-golang plus the git tool), runs on my laptop with the -u arg, but if I run it on an debian virtual machine, it tells me No user exists for uid 1001Ideally, you would make your own image (based on an existing one) with the right expected ID:RUN useradd -r -u 1001 -g appuser appuser USER appu...
How can I attach VS Code to a node process running in a docker container
I'm trying to attach the Visual Studio Code debugger to a node.js app that is running inside a Docker container.I start the app like:node --debug-brk app.jsI expose the debugger port indocker-compose.yml:app: build: . working_dir: /code volumes: - .:/code command: npm run debug ports: - "3004:3000" ...
This feature is now officially supported by VSCode:https://github.com/Microsoft/vscode-node-debug/issues/8
Where to see the Dockerfile for a docker image?
Is there a way to see the Dockerfile that generated an image I downloaded, to use as a template for my own docker images?
Usedocker history --no-trunc IMAGE_NAME_OR_IDThis will show all commands run in the image building process in reverse order. It's not exactly a Dockerfile, but you can find all essential content.
Spring Boot and Nginx integration
In my project, web app is developed using Spring boot with default tomcat server. I am using NGINX as load-balancer and have configured my spring-boot-web-app in NGINX configuration as follows:location /spring-boot-web-app { proxy_pass http://spring-boot-web-app/ } http { upstream /spring-boot-web-app { ...
This works for me. Can you try this?Running tomcatdocker run -d -p 8080:8080 --name=tomcat tomcat:8Running nginxdocker run -d -p 80:80 --link tomcat:tomcat --name=nginx nginxGo inside nginx container and update the confdocker exec -it nginx bash/etc/nginx/nginx.conf:server { listen 80 default_server; server_name s...
How to build a go executable that doesn't link to musl libc
So:The official Go build container is based on Alpine.Alpine usesmuslas libc instead of glibc.I need to build a Go executable in a container that can be run on Ubuntu, which uses glibc.How do I eitherMake the official GoLang build container use glibc orBuild my GoLang project on an Ubuntu based containerI can't use the...
Thegolang:latestimage is based on debian bullseye. You don't need anything else than using this image to build your binary so that it can be run as is on ubuntu.Just start your dockerfile with this line instead of what you're currently using.FROM golang:latest
How can I run a docker container on localhost over the default IP?
I'm following thefollowing tutorialon how to start a basic nginx server in a docker container. However, the example's nginx docker container runs on localhost (0.0.0.0) as shown here:Meanwhile, when I run it it for some reason it runs on the IP 10.0.75.2:Is there any particular reason why this is happening? And is ther...
The default network is bridged. The0.0.0.0:49166->443shows a port mapping of exposed ports in the container to high level ports on your host because of the-Poption. You can manually map specific ports by changing that flag to something like-p 8080:80 -p 443:443to have port 8080 and 443 on your host map into the contain...
How to correctly pass ssh key file from Jenkins credentials variable into to docker build command?
This question is a follow up to this questionHow to pass jenkins credentials into docker build command?I am getting the ssh key file from jenkins credential store in my groovy pipeline and passing it into docker build command via --build-arg so that I can checkout and build artifacts from the private git repos from wit...
I ran into the same issue yesterday and I think I've come up with a workable solution.Here are the basic steps I took - using thesshagent pluginto manage the sshagent within the Jenkins job. You could probably use withCredentials as well, though that's not what I ended up finding success with.The ssagent (or alternati...
docker host port and container port
I am running a database container. I know to inspect port mappings, I can use commanddocker port . So, I tried that command:$docker port ea72b2c4ba47 3306/tcp -> 127.0.0.1:3666I see the output, but which one means the port used by host machine and which one is the port of container?
3306/tcp -> 127.0.0.1:3666means port 3306 inside container is exposed on to port 3666 of host.More infohere.If you think output ofdocker portcommand is confusing then use docker inspect command to retrieve port mapping. As mentionedherein official doc.docker psdocker portdocker inspectare useful commands to get the inf...
How to delete/disable docker0 bridge on docker startup
Is there any way we can disable docker0 bridge on docker startup ?Tried "bridge": "none" in daemon.json but its not working.Also removed default docker bridge using "ip link delete docker0" but when we restart docker it came up automatically. So any permanent way to disable/delete default docker bridge on startup ? I s...
I think I found the answer. Inorder to disable the default bridge network add"bridge": "none"indaemon.jsonand restart docker service. The changes will taken effect immediately if there are no running containers. In my case there were some containers already running, so changes not taken effect. After inspecting the log...
when i use docker-compose to install a fastapi project, i got AssertionError:
when I use docker-compose to install a fastapi project, I gotAssertionError: jinja2 must be installed to use Jinja2Templatesbut when I use env to install it, that will be run well.my OS:Ubuntu18.04STLmy requirements.txt:fastapi~=0.68.2 starlette==0.14.2 pydantic~=1.8.1 uvicorn~=0.12.3 SQLAlchemy~=1.4.23 # WSGI Werkze...
I had a same problem on heroku, the error comes from Jinja2 version 2.11.x and it run locally but not in Heroku.Just install latest version of jinja2 it will work fine in your case too.pip install Jinja2==3.1.2 or pip install Jinja2 --upgrade
How to start another bash in Dockerfile
I want to update GCC from 4.4.7 to 4.7.2 in a container(CentOS 6.9) following this tutorialHow to upgrade GCC on CentOS.In the end of the tutorial, the author usesscl enable devtoolset-1.1 bashto launch a new shell where all the environments are updated. I write the following Dockerfile:Run ... \ && yum install devto...
Among the directives of the Dockerfile, you have SHELLhttps://docs.docker.com/engine/reference/builder/#shellfrom this docThe SHELL instruction can also be used on Linux should an alternate shell be required such as zsh, csh, tcsh and others.
Azure build pipeline, docker compose - set environment variable
I have a build pipeline that runs a docker image with some java program that is run using maven.Selected pipeline stepRun automation testsis starting docker-compose that starts my java program inside docker, as you can see I also set system environment valueFEATURES_LISTwith some test value, now inside my java program,...
The "Environment Variables" in the Docker Compose task not inject the variables into the containers so the Java application can't read them, but they are will be available in the agent during the process.The variables are for use in thedocker-compose.ymlin this way:${variableName}.So you can define in the Docker Compos...
Unable to run docker image due to libGl error
DockerfileFROM python:3.6.8 COPY . /app WORKDIR /app RUN pip3 install --upgrade pip RUN pip3 install opencv-python==4.3.0.38 RUN pip3 install -r requirements.txt EXPOSE 80 CMD ["python3", "server.py"]requirements.txtFlask==0.12 Werkzeug==0.16.1 boto3==1.14.40 torch torchvision==0.7.0 numpy==1.15.4 sklearn==0.0 scipy==1...
I was able to make the docker container run by making following changes to the dockerfileFROM python:3.6.8 COPY . /app WORKDIR /app ENV DEBIAN_FRONTEND noninteractive RUN apt-get update -y RUN apt install libgl1-mesa-glx -y RUN apt-get install 'ffmpeg'\ 'libsm6'\ 'libxext6' -y RUN pip3 install --upgrade pip R...
Xdebug (inside Docker container) ignoring XDEBUG_CONFIG environment variable
I'm running a PHP application on Docker and I'd like to debug it using XDebug. In my docker-compose I added the following lines in the phpfpm part:environment: XDEBUG_CONFIG: "remote_enable=1 remote_host=192.168.110.29 remote_port=9000 idekey=PHPSTORM remote_autostart=1" PHP_IDE_CONFIG: "serverName=reports....
I had the same problem. My image was based onnimmis/alpine-apache-php7/. I found that the image was usingsupervisorto start processes.supervisorhas no knowledge of the Docker environment variables.The convention to tellsupervisorthat a process needs to be run, is to create arunscript at/etc/sv/{process}/run.A script li...
how to remove an ENV setting from a docker image
I have a docker image which sets HOME and PATH:[{ ... "config": { "HOME=/", } ...I know I can replace it, but is it possible to remove it (and let the normal bash profile settings be used instead). I'd prefer not to hack the shell profile files to override it.
You can simply perform a manual commit.This operation is not available within the Dockerfile, but can be done manually.When doingdocker inspect , you can retrieve the ID of the container that has been used in order to create this image.You can do thendocker commit and all the ENV and other config will get flushed.If t...
403 "Error: Forbidden" when opening the URL of my Cloud Run service
I built my container image and then deployed to Cloud Run using the Cloud Console. However, when I open the endpoint URL of my service, I get a403 "Error: Forbidden"page
If you receive a 403 "Error: Forbidden" error message when accessing your Cloud Run service, it means that your client is not authorized to invoke this service. You can address this by taking one of the following actions:If the service is meant to be invocable by anyone,update its IAM settingsto make the service public...
.pgpass for PostgreSQL replication in Dockerized environment
I try to set up an PostgreSQL slave using Docker and a bash script (I use Coreos). I have not found any way to supply a valid.pgpass.I know I could create a PGPASSWORD environment variable, but do not wish to do so for security reasons (as stated here,http://www.postgresql.org/docs/current/static/libpq-envars.html),, a...
You have to create a.pgpasson the home folder of the user who's going to be running the commands (in this case,postgres). Each line of the file has to be in theformathostname:port:database:username:passwordand supports wildcards, so you can just set the database to "*" for example.In my case, I have something like this...
How to stream the logs in docker python API?
I am building an image from a Dockerfile using the docker python API.import os import sys import os.path import docker client = docker.from_env() try: here = os.path.dirname(__file__) no_cache = False dockerfile = os.path.join(here, 'app', 'nextdir') image = client.images.build(path=dockerfile, tag='a...
Streaming the docker build logs can be done using the low-level APIs given indocker-pyas follows,here = os.path.dirname(__file__) dockerfile = os.path.join(here, 'app', 'nextdir') docker_client = docker.APIClient(base_url='unix://var/run/docker.sock') generator = docker_client.build(path=dockerf...
docker image - merged/diff/work/LowerDir components of GraphDriver
Below is the manifest file entry snippet (docker inspect image redis) of redis image"GraphDriver": { "Data": { "LowerDir": "/var/lib/docker/overlay2/bd512eb256c8aa56cbe9243d440a311820712d1a245fe6f523d39d19cd6c862d/diff:/var/lib/docker/overlay2/7fa1e90f35c78fc83c3a 4b86e36e45d742383b394adf9ce...
LowerDir: these are the read-only layers of an overlay filesystem. For docker, these are the image layers assembled in order.UpperDir: this is the read-write layer of an overlay filesystem. For docker, that is equivalent to the container specific layer which contains changes made by that container.WorkDir: this is a re...
nginx does not automatically pick up dns changes in swarm
I'm running nginx vialets-nginxin the default nginx configuration (as per the lets-nginx project) in a docker swarm:services:ssl: image: smashwilson/lets-nginx networks: - backend environment: -[email protected]- DOMAIN=api.finestructure.co - UPSTREAM=api:5000 ports: - "80:80" ...
Thanks to @Moema's pointer I've come up with a solution to this. The default configuration of lets-nginx needs to be tweaked as follows to make nginx pick up IP changes:resolver 127.0.0.11 ipv6=off valid=10s; set $upstream http://${UPSTREAM}; proxy_pass $upstream;This uses docker swarm's resolver with a TTL and set...
.dockerignore fails to include files in subdirectories with !**/*.extension pattern
I'm having trouble with the.dockerignorefile. This is my project structure:file.sh file.js file.go file.py subdir/ file2.go file2.py .dockerignore DockerfileAccording to the.dockerignoredocumentation:(...) you may want to specify which files to include in the context, rather than which to exclude. To achieve th...
I found a few issues that mention this exact problem, like these:Exception patterns in .dockerignore do not support wildcard directoriesdockerignore does not respect the "special wildcard **"(comment)And it seems like it's not gonna be fixed any time soon :(
Gracefully Stopping Docker Containers
I'm having some trouble to understand how I can do some cleanup when the container is stopped.To make it easier, I prepared a sample to reproduce the problem.Here are the contents of my files:DockerfileFROM opensuse:latest # Install tcsh (non-interactive mode) RUN zypper -n in tcsh # Create user RUN useradd -ms /bin/...
Finally solved the problem.Tcsh shell doesn't receive most of the signals like SIGTERMwhich is the signal sent by docker when stopping the container.So I changed the script to use bash shell and whenever I want to run a tcsh command I just do it like this:/bin/tcsh ./my-commandSo, mydocker-entrypoint.shis like this:#!/...
Is it necessary to RUN apk update && apk upgrade in a docker build stage?
I'm creating a multi stage build docker file. In the deployment step that will actually run the program i'm runningRUN apk update && apk upgrade --no-cacheShould I also have this statement in my build stage?
It isn't necessary to alwaysapk update/upgradein your dockerfile. However it surely isn't a bad idea. Especially if you install packages withapk, you should make sure that the package list is up-to-date. So you always get the latest version of the package you want to install.Installing security updates on build time do...
Using rbenv with Docker
I am trying to setup rbenv with a Dockerfile, but this just fails onrbenv install. I do have ruby-build in there, it just doesn't seem to work.Relevant bits of the Dockerfile (largely lifted fromhttps://gist.github.com/deepak/5925003):# Install rbenv RUN git clone https://github.com/sstephenson/rbenv.git /usr/local/rbe...
You're missing a setup step forruby-build: You need to run itsinstall.shafter you cloned it.
docker-compose - Can I update traefik labels without restarting a container?
Can I update labels on a container using docker-compose without restarting the container?Ideal scenario: - change labels in docker-compose.yml - save docker-compose.yml - run a command to update the labels without restarting the container
As a general rule, changing the settings or code running inside a container involves deleting and restarting the container. This is totally normal, anddocker-compose upwill do it for you when necessary. (Remember to make sure any data you care about is stored outside the container.)At a Docker API level, there are on...
Mounted folder created as root instead of current user in Docker
trying to mount a volume to my container from thedocker runcommand. It seems like the folder is always created as root instead of the container user. This makes it so that I'm lacking rights on the folder(cant create or write files for logging).Doing some testing using this command:docker run -it --entrypoint /bin/bash...
At the moment, this is a recurring issue with no simple answer.There are two common approaches I hear of.First involveschowning the directory before using it.RUN mkdir -p /home/jboss/myhub/logs ; chown -R jboss:jboss /home/jboss/myhub/logs USER jbossIn case you need to access the files from your host system with a diff...
Docker-Compose: Service xxx depends on service xxx which is undefined
I'm having this error:ERROR: Service 'db' depends on service 'apache' which is undefined.Why is it saying that apache is undefined? I check the indentation. Should be the right one.version: '3.5' services: apache: build: ./Docker image: apache:latest ports: - "80:80" restart: always networks: ...
No, it's not defined. You have overwritten oneserviceswith the other one.You should fix the configuration:version: '3.5' services: apache: build: ./Docker image: apache:latest ports: - "80:80" restart: always db: image: mariadb:latest restart: always environment: MYSQL_ROOT_P...