Prompt stringlengths 14 160 | Instruction stringlengths 18 2k | Response stringlengths 8 2k |
|---|---|---|
Docker-compose - Redis at 0.0.0.0 instead of 127.0.0.1 | I havs migrated my Rails app (local dev machine) to Docker-Compose. All is working except the Worker Rails instance (batch) cannot connect to Redis.Completed 500 Internal Server Error in 40ms (ActiveRecord: 2.3ms)
Redis::CannotConnectError (Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)):In my docke... | Facepalm!!!The docker containers were communicating just fine, the problem was I hadn't told Resque (the app using Redis) where to find it. Thank you to "The Real Bill" for pointing out I should be using docker-cli.For anyone else using Docker and Resque, you need this in yourconfig/initializers/resque.rbfile:Resque.re... |
Docker compose not prepending project name to the container names when running multiple instances | I have a set of docker that I run usingdocker-compose up -dpretty basic so farI want to run multiple instances of my project and I have read thisRun multiple docker composeNow when runningdocker-compose up -p PRNAME -dcompose is not prepending project name to containers likeprname_container1and I'm getting the followin... | When you explicitly setcontainer_name:in yourdocker-compose.ymlfile, the container name will beexactlywhat you specify; Docker Compose won't add its per-directory prefix to it.Usually this doesn't matter to you at all, and it's safe to removecontainer_name:. You will still be able to reach other containers using their... |
Installing homebrew packages during Docker build | I am trying to install setup a docker image and want certain Homebrew packages pre-installed when I run the container. I am able to build it just fine and version statements are working as expected but when I run the installed packages are missing. Any idea what I am doing wrong?RUN git clone https://github.com/Homebre... | You have to set the PATH environment variable in the Dockerfile with:ENV PATH=~/.linuxbrew/bin:~/.linuxbrew/sbin:$PATHHere is a complete working Dockerfile:FROM debian
RUN apt-get update && apt-get install -y git curl binutils clang make
RUN git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew \
&& mkdir ~/... |
Ubuntu based docker-machine image | Is there a possibility to simply create a docker-machine that is non-boot2docker based (i.e., Ubuntu based) (which uses virtualbox driver)?I would like to have full-featured Linux distro running the docker daemon on my mac instead of Tiny Core Linux distro which is fast and lightweight but doesn't offer me all the debu... | You could take advantage of the--virtualbox-boot2docker-urloption.This issueillustrates its usage (with an iso which isnota TinyCore one, but aRancherOS one)docker-machine create -d virtualbox --virtualbox-boot2docker-url https://releases.rancher.com/os/latest/machine-rancheros.iso rancherIf RancherOS is a bit too bare... |
How to configure docker entrypoint in Helm charts | I have the followingdocker-composefile and I don't get how I can set theworking_dirandentrypointin the helmdeployment.yaml. Does someone have an example on how to do this?docker-composeversion: "3.5"
services:
checklist:
image: ...
working_dir: /checklist
entrypoint: ["dotnet"... | Helm uses KubernetesDeploymentwith a different terminology than Docker. You'll want to define:commandin Helm forentrypointin Docker Compose (seethis post)workingDirin Helm forworking_dirin Docker Compose (seethis post)For your example it would be:...
containers:
- name: checklist
...
command: ["dotnet", "Checkli... |
How can I persist go 1.11 modules in a Docker container? | I am migrating a Go 1.10 app to Go 1.11. This also includes migrating fromdeptomodfor managing dependencies.As the application depends on a database, I am using adocker-composeto set up the local development environment. With Go 1.10 I simply mounted the local repository (including thevendorfolder) into the correct loc... | This is not mentioned in the wiki article on modules, but from reading the updated docs on thego tool, I found out that when using Go modules, thegotool will still useGOPATHto store the available sources, namely$GOPATH/pkg/mod.This means that for my local dev setup, I can 1. define theGOPATHin the container and 2. moun... |
Can Testcontainers create docker network for me if it does not exist? | Looks like I need a network because I would like to reference one container by hostname from another.I could also use the--linkbut it is deprecated and can disappear soon. That's why I wonder if Testcontainers can create a docker network for me.With command line I would just executedocker network create bridge2and then... | Yes, you can create networks with TestContainers. We're going to document it soon, but it's as simple as:First, create a network:@Rule
public Network network = Network.newNetwork();Then, configure your containers to join it:@Rule
public NginxContainer nginx = new NginxContainer<>()
.withNetwork(network) // <---... |
npm install doesn't work in Docker | This is my Dockerfile:FROM node:7
RUN apt-get update && apt-get install -y --no-install-recommends \
rubygems build-essential ruby-dev \
&& rm -rf /var/lib/apt/lists/*
RUN npm install -gq gulp bower
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN npm install
CMD ["gulp", "start:dev"]... | Thenpm installshould have worked based on yourDockerfile. You can see the created files if you run the image without a mounted volume (DIRNAME: where yourdocker-compose.ymlis located):docker run --rm -it DIRNAME_node ls -ahl /usr/src/appWithdocker build, all data is stored in the image. So, it's intended that you don't... |
Why can't docker build COPY files to the /dev folder? | I want to create a docker image where I add a file to the/devfolder. I'm using thisDockerfile:FROM ubuntu:bionic
COPY test.txt /dev/After building this with:docker build -t test .I get a docker image where nothing has been added to the/devfolder. No error has been thrown bydocker build.I find this very strange because ... | /devis a special folder on linux systems reserved to maintain the devices related ressources (filesystem, disks, etc...) and mounted on a special filesystem. In a docker container, it will be remounted with a tmpfs dedicated filesystem and is not on the main container filesystem (/). See the following example:$ docker ... |
How to reduce default VM memory for Docker Linux containers on Windows | ScenarioWindows 10 ProfessionalDocker 18.06.1-ce running in Windows container mode4GB of available memory on host systemusing Hyper-V virtual machineProblemWhen trying to "switch to Linux containers" via Docker's taskbar item the process fails after a couple of seconds showing an error about "Not enough memory to start... | After some searching I found out that settings of Docker's user interface are stored in%APPDATA%\Docker\settings.json(e.g.C:\Users\olly\AppData\Roaming\Docker), memory settings are defined inmemoryMiBproperty.The following solved the problem on my environement:quit Dockermodifysettings.jsonfile usingnotepad %APPDATA%\D... |
Container File Permissions in Windows Container | I've got a Windows Docker container (microsoft/aspnet) that is hosting a simple Web API. The web API accepts files from a form, saves them in a temp folder, does some processing, and then returns the result.This works fine when deployed locally, but when done in my Docker container, I get a file permissions error on my... | Unclear why, butcaclsdoesn't seem to be working when run as part of building the container. Switched to usingicacls, and was able to grant theIIS_USRSpermissions on the folder.Line added to dockerfile:RUN icacls 'C:\inetpub\wwwroot\App_Data' /grant 'IIS_IUSRS:(F)' |
Pass arguments to Python running in Docker container on AWS Fargate | Passing arguments to a Docker container running a Python script can be done like sodocker run my_script:0.1 --arg1 val --arg2 val ...I can't seem to figure out how to pass those arguments when running the container on AWS Fargate (perhaps it doesn't work?) | You can usecontainer definitions parametersin ECS task definition to pass runtime arguments.Commandparameter maps to COMMAND parameter in docker run."command": [
"--arg1",
"val",
"--arg2",
"val"
],It is also possible to pass parameters as environment variables."environment": [
{
"name": "LOG_LEVEL",
"... |
docker, nginx, django and how to serve static files | Goal: The set of docker containers for a production django website deployment.My hang up in this process is that usually nginx directly serves the static files... Based on my understanding of a good architecture using docker, you would have a container for your wsgi server (probably gunicorn), a separate nginx containe... | With reference to serving static files, your options depend on the functionality of your application. There's a very nifty tool calleddj-staticwhich will help you serve static files by adding very minimal code.The documentation is fairly simple and all you have to do is followthese steps. |
What do two asterisks mean in a .dockerignore file? | In my .dockerignore file, I see many lines starting with two asterisks like below.**/.git
**/.gitignore
**/.projectWhat does this mean? | It's the same as the.gitignorenotation, ignoring the specified file in any sub-directory recursively, including the current directory. A single star would only include one level of sub-directories.For more on the.dockerignoresyntax, see:https://docs.docker.com/engine/reference/builder/#dockerignore-fileHere's the state... |
In a GitHub Action, how do I override a service's entrypoint? | I need to define a service in my GitHub action and override its entrypoint by adding arguments to it. How can I do this?Here's a docker-compose that works that I'm trying to translate.version: '2'
services:
config:
build: .
links:
- etcd
etcd:
image: microbox/etcd:2.1.1
entrypoint: "etcd --li... | From what I can tell, it's not possible.The simplest thing to do is to run the docker create command with the entrypoint override and it's args as a build step. Something like this:name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
...
- run: docker create --name build_etcd --net... |
Spark/k8s: How to run spark submit on Kubernetes with client mode | I am trying to usespark-submitwithclientmode in the kubernetes pod to submit jobs to EMR (Due to some other infra issues, we don't allowclustermode).
By default,spark-submituses thehostnameof the pod as thespark.driver.hostand thehostnameis the pod's hostname sospark executorcould not resolve it. And thespark.driver.p... | Spark submit can take additional args like,--conf spark.driver.bindAddress, --conf spark.driver.host, --conf spark.driver.port, --conf spark.driver.blockManager.port, --conf spark.port.maxRetries. Thespark.driver.hostanddriver.portis used to tell Spark Executor to use this host and port to connect back to the Spark sub... |
'dist' folder is not generated while doing npm build in a Dockerfile | I usually write Dockerfiles for Java / Go applications and it's the first time I have encountered a situation where I have to write a Dockerfile for an already existing (and production running) Node.js application. As per my little knowledge about the Node.js which I acquired in the past couple of days,distfolder is ge... | If you are using typescript in your node application then follow these instructions.Please add the below entry undercompilerOptionssection on "tsconfig.json"tsconfig.json**"outDir": "./dist/"**package.json - Add the below script too."scripts": { "build": "tsc" }Now, re-run the "npm run build". You will see the dist fol... |
Can docker-compose share an ip between services with discrete ports? | We currently have docker containers with complex builds using supervisord so that we can group services together. For example, nginx and ssh.I'm attempting to rebuild these with more service-driven isolation linked by shared volumes. However,without mapping the IP to the host, I can't seem to find a way to allow IP a... | Is it possible to configure docker-compose/docker-networking to route by the port to allow the same IP address to be used for different containers?Yes we can(familiar? -_-!). There is an option of network mode presented by Docker, calledservice:service-name.When we executedocker run, we could add--network=service:servi... |
Can't run multiple mongodb docker container with same shared volume | I want to run two mongo docker containers with docker compose. The mongo containers have same shared volumes with the docker host. When I ran it with docker compose, only one mongo container is working meanwhile the other is shutting down because it saidDBPathInUse: Unable to lock the lock file: /data/db/mongod.lock
... | The problem is here:The mongo containers have same shared volumes with the docker hostYou cannot run two mongo instances on the same data-directory. It would lead to data corruption and strange problems, so mongo-db explicitly prohibits doing that (see alsothisquestion here)Why do you want to do this? Normally you woul... |
Docker Jenkins images login error | I'm new to docker, i trying to use jenkins on docker. So I pull jenkins image with this commanddocker pull jenkinsJenkins installed without any error. After that i started jenkins image like the document said.https://hub.docker.com/r/_/jenkins/docker run -p 8080:8080 -p 50000:50000 -v /your/home:/var/jenkins_home jenki... | The password was saved to/var/jenkins_home/secrets/initialAdminPassword.You can usedocker exec cat /var/jenkins_home/secrets/initialAdminPasswordwhereis your container id or name. |
How do I dockerize an existing application...the basics | I am using windows and have boot2docker installed. I've downloaded images from docker hub and run basic commands. BUT
How do I take an existing application sitting on my local machine (lets just say it has one fileindex.php, for simplicity). How do I take that and put it into a docker image and run it? | Your index.php is not really an application. The application is your Apache or nginx or even PHP's own server.Because Docker uses features not available in the Windows core, you are running it inside an actual virtual machine. The only purpose for that would be training or preparing images for your real server environm... |
If I use EXPOSE $PORT in a Dockerfile, can I un-expose the port it when I use `docker run`? | I'm working on a Dockerfile for a web app that will use annginx-proxycontainer. It's also got a CLI for doing app domain stuff (creating/modifying db, running cleanup jobs, etc.)In 99% of cases, when I boot a container, I want to use the webapp. I've got anEXPOSE 3000in the Dockerfile and that works perfectly well for ... | As far as I know that's not possible now. The best thing you can do is too use the-Poption to map the 3000 to some random port, so it won't conflict with the main container instance, e.g.docker run -it -P This will result in the followingdocker psmain_container 0.0.0.0:3000->3000/tcp
run_container 0.0.0.0:32769->3... |
File not found in docker container | I'm doing something extremely simple. Here is myDockerfile:FROM alpine:latest
ADD hello.sh /bin/hello
RUN chmod +x /bin/hello
CMD /bin/helloThen I build the image:docker build -t hello .Then I run the image:docker run helloAnd here is the output:/bin/sh: /bin/hello: not foundWhy is this happening? If I run:docker r... | Problem solved by using an ubuntu image instead of an alpine image. Not exactly sure why, but might have to do with the file's user/permission bits getting copied over and not interpreted correctly. |
How to install Docker inside my ubuntu container? | I installed docker inside a container running onubuntu:18.04to run my nodejs app, I need docker installed inside this container because i need to dockerize an other small appHer is my DockerfileFROM ubuntu:18.04
WORKDIR /app
COPY package*.json ./
# Install Nodejs
RUN apt-get update
RUN apt-get -y install curl wget d... | First thing better to use one of the base images, either fornode-imageand install docker and fordocker-imageand installed node, instead of creating image from scratch. All you needFROM node:buster
RUN apt-get update
RUN apt install docker.io -y
RUN docker --version
ENTRYPOINT nohup dockerd >/dev/null 2>&1 & sleep 10 ... |
Running docker securely | I understand that the docker daemon requires toruns as rootso I'm told this can cause some security implications such as if the container were compromised, attackers can make changes to the host's system files.What precautions can I take to mitigate damage in the case of an attack?Is there a practice that I should be a... | The main source of information regarding docker security practice is the page on "Docker security".only trusted users should be allowed to control your Docker daemon.This is a direct consequence of some powerful Docker features.Specifically, Docker allows you to share a directory between the Docker host and a guest con... |
How to let syslog workable in docker? | My application will send out syslog local0 messages.
When I move my application into docker, I found it is difficult to show the syslog.I've tried to run docker as --log-dirver as syslog or journald, both works strange, the /var/log/local0.log show console output of docker container instead of my application's syslog w... | CentOS 6:1.Plugin module not found in 'module-path'; module-path='/lib64/syslog-ng', module='afsql'
Starting syslog-ng: Plugin module not found in 'module-path'; module-path='/lib64/syslog-ng', module='afsql'You can fix above error by installingsyslog-ng-libdbipackage:yum install -y syslog-ng-libdbi2.Error opening fil... |
Changing /proc/sys/kernel/core_pattern file inside docker container | How can i change/proc/sys/kernel/core_patternfile inside the docker container with out privileged mode? Are there any flags to be passed todocker daemonordocker runor anything related toDockerfile? | The kernel does not support per-container patterns. There is a patch for this, but it is unlikely to go in any time soon. The basic problem is that core patterns support piping to a dedicated process which is spawned for this purpose. But the code spawning it does not know how to handle containers just yet. For some re... |
Exiting due to GUEST_MOUNT_CONFLICT : While starting minikube | I am trying to usekubernetesfor local deployment usingminikube, I want to mount a share a directory between host machine and pods. For this, I am trying to mount directory tominikube. But I already had minikube running on which few deployments were running. I deleted them. But every time I restart minikube with mount I... | The error you see happens when you try to change the mount configuration on an existing cluster when using Docker. Docker doesn't allow changing of volumes after the container has been created and thus you cannot change themount-stringonminikube startafter the cluster has already been created. More info and source for ... |
Plugin caching_sha2_password could not be loaded: /mariadb19/plugin/caching_sha2_password.so: cannot open shared object file | I am trying to dockerise my Django app.docker-compose.ymlversion: "3.8"
services:
db:
image: mysql:8
command: --default-authentication-plugin=mysql_native_password # this is not working
restart: always
environment:
MYSQL_ROOT_PASSWORD: rootmypass
ports:
- '3306:3306'
cache:
imag... | Stopping the container usingdocker-compose downand then restarting them did the trick. I was using CTRL + C prior to that. |
Update & Upgrade Docker distribution on Windows | At the moment I've got Docker v.1.7 and I'd want to upgrade it to latest (1.8 at the moment).Important part:I want to do this without installing Docker and boot2docker again. I wasn't able to find any info about it.Is it possible? And how can I do this? | If you already have boot2docker, the upgrade is the usual:boot2docker stop
boot2docker download
boot2docker start
docker@boot2docker:~$ docker version
Client:
Version: 1.8.1
API version: 1.20
Go version: go1.4.2
Git commit: d12ea79
Built: Thu Aug 13 02:49:29 UTC 2015
OS/Arch: linux/amd64Tha... |
Docker php_network_getaddresses error | I have following Docker containers running that were generated byPHPDocker:learn-php-mysql:
image: mysql:5.7
container_name: learn-php-mysql
volumes:
- "./.data/db:/var/lib/mysql"
restart: always
environment:
MYSQL_ROOT_PASSWORD: learning
MYSQL_DATABASE: learning
MYSQL_USER: learning
MYSQL... | When making connection via PHP (or any other), use the container's name as host, which in case islearn-php-mysql.Thus$mysqli = new mysqli("learn-php-mysql", "learning", "learning", "learning");Will work. |
Kubernetes container connection to RDS instance in separate VPC | I have a Kubernetes cluster running in Amazon EC2 inside its own VPC, and I'm trying to get Dockerized services to connect to an RDS database (which is in a different VPC). I've figured out the peering and routing table entries so I can do this from the minion machines:ubuntu@minion1:~$ psql -h
Password:So that's all ... | With the help of Kelsey Hightower, I solved the problem. It turns out it was a Docker routing issue. I've written up the details in ablog post, but the bottom line is to alter the minions' routing table like so:$ sudo iptables -t nat -I POSTROUTING -d /32 -o eth0 -j MASQUERADE |
Can access docker service from curl but not from postman/chrome | I'm doing the docker getting started guide:https://docs.docker.com/get-started/part3/#recap-and-cheat-sheet-optionaldocker-compose.yml:version: "3"
services:
web:
# replace username/repo:tag with your name and image details
image: username/repo:tag
deploy:
replicas: 5
resources:
limits... | Seeing thecurl -4 ...makes me suspect this is an ipv6 issue. If your local machine isn't configured for ipv6 and localhost has a reference to the ipv6 address in the hosts file, then calls to localhost will hang.The workaround is rather simple, go to127.0.0.1instead oflocalhostin your urls. |
Docker compose bind failed: port is already allocated | I have been trying to get a socketio server moved over from EC2 to Docker.I have been able to connect to the socket via a web (http) client, but connecting directly to the socket via iOS or Android seems to be impossible.I read one of the issues can be the ports exposed are not actually published when using Docker. Sin... | Getting "Bind for 0.0.0.0:8080 failed: port is already allocated".you have duplicated port allocations.when not specifying a connection type,the port defaults totcp:meaning"0.0.0.0:8080:8080"and"0.0.0.0:8080:8080/tcp"both trying to bind to the same port and hence your error.sincedocker uses0.0.0.0for default binding, s... |
Can I Run a dotnet app which is hosted on IIS in a docker container? | I have developed a web application using asp dotnet and currently I have it running on IIS is there anyway I can run the same app in a docker container,I am relatively new to Docker and I have played around a bit and I am familiar with docker compose , so I was wondering if I can (dockerize) the application that I have... | You need to change a little your Dockerfile, try this:#Making a dotnet container
FROM microsoft/iis
SHELL ["powershell"]
RUN Install-WindowsFeature NET-Framework-45-ASPNET ; \
Install-WindowsFeature Web-Asp-Net45
RUN Remove-WebSite -Name 'Default Web Site'
RUN New-Website -Name 'app' -Port 80 \
-Physic... |
Can not connect to Postgres Container from pgAdmin | related posts:
1)docker postgres pgadmin local connection2)https://coderwall.com/p/qsr3yq/postgresql-with-docker-on-os-x(in the example "Name" entry is not filled in)there are two ways to complete this task, I use official postgresMETHOD 1:and runs it withsudo docker run --name some-postgres -e POSTGRES_PASSWORD=mysecr... | Since you're mapping the port 5432 on the container to the same port on host with-p 5432:5432in yourdocker runstatement, try connecting pgadmin to port 5432 on the host instead of the container. |
Orphaned Tasks in Docker Swarm after removal of failed node | Last week I had to remove a failed node from my Docker Swarm Cluster, leaving some tasks that ran on that node in desired state "Remove".Even after deleting the stack and recreating it with the same name,docker stack ps stacknamestill shows them.Interestingly enough, after recreating the stack, the tasks are still ther... | I had the same problem. I resolved it followingthis instructions:docker run --rm -v /var/run/docker/swarm/control.sock:/var/run/swarmd.sock dperny/tasknuke Be sure to use the full long task id or it will not work (fkgz0oihexzsjqwv4ju0szorhin your case). |
docker swarm list dependencies of a service | Let's say we have the following stack file:version: "3"
services:
ubuntu:
image: ubuntu
deploy:
replicas: 2
restart_policy:
condition: on-failure
resources:
limits:
cpus: "0.1"
memory: 50M
entrypoint:
- tail
- -f
- /dev/null
loggi... | Thedepends_onisn't used on docker swarm:Thedepends_onoption is ignored when deploying a stack in swarm mode with a version 3 compose file. -from Docker DocsAnother good explanation on GitHub:depends_onis a no-op when used withdocker stack deploy. Swarm mode services are restarted when they fail, so there's no reason to... |
What is inside a Docker Ubuntu Image if Docker doesn't encapsulate an OS? | I'm starting a new Django Project using Docker. I'm confused about the existence of the Ubuntu Docker image which is mentioned in many tutorials as well as being one of the most popular images in the Docker Repo.I thought Docker is a containerization system built ON TOP of the OS, so why is there an Ubuntu Docker Imag... | With a Linux distro you normally get:A bootloader which loads a kernelA kernel which manages the system and loads an init systemAninitsystem that sets up and runs everything elseEverything elseDocker itself replaces most of theinitsystem.Docker images replace "Everything else", which can still be a large portion of any... |
Sharing /tmp between two containers | I'm usingdocker-composeto spawn two containers. I would like to share the/tmpdirectory between these two containers (but not with the host/tmpif possible). This is because I'm uploading some files throughflaskto/tmpand want to process these files fromcelery.flask:
build: .
command: "gulp"
ports:
- '... | You can used a named volume:flask:
build: .
command: "gulp"
ports:
- '3000:3000'
- '5000:5000'
links:
- celery
- redis
volumes:
- .:/usr/src/app:rw
- tmp:/tmp
celery:
build: .
command: "celery -A web.tasks worker --autoreload --loglevel=in... |
A completely closed source docker container | I was wondering if it is possible to offer Docker images, but not allow any access to the internals of the built containers. Basically, the user of the container images can use the services they provide, but can't dig into any of the code within the containers.Call it a way to obfuscate the source code, but also offer ... | An obfuscation-based only solution would not be enough, as "Encrypted and secure docker containers" details.You would need full control of the host your containers are running in order to prevent any "poking". And that is not the case in your scenario, where a developer does have access to the host (ie his/her local de... |
What is the most simple setup for a MEAN stack docker container to have the same config on OS X and DigitalOcean? | I am playing around with a MEAN javascript project.
(mongoDB + angular + sails.js + node.js)
As I am offline a lot of the time, I'd like to keep my dev environment, running in a docker container, on OS X laptop, using boot2docker.The 'production' (not actual production, just somewhere I deploy to to show it to friends)... | Answers to your questions:Do I need anything else other than what I described above?What you described sounds very reasonable. But keep in mind that you don't want to useonedocker container, but ratherone container per service. That means: one container running mongo, one container running node, and so on. That is a Do... |
Why 0.0.0.0 is working and localhost or 127.0.01 is not | I have a grpc-go server running in docker container, listening on0.0.0.0:8080. I found this to be working after having failures with listening onlocalhostor127.0.0.1in a docker container - and it only failed running in a docker container, not if I go run on the same machine.Also a simple web server did work listening o... | Networking is one of the namespaces in docker, similar to the pid and filesystem namespaces. If you kill pid 1 inside a container, that kills the process inside the container and not systemd/init on the host (as long as you don't override the namespace). And if yourm -rf /bininside a container, that deletes files from ... |
Updating Wordpress inside a container. No FTP access | I installed a Wordpress website with thewordpressDocker image, and then installed my themes. All works well, but when I want to update Wordpress later on, I get this message:To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember y... | The key is to make sure your web server is the owner of the directory WordPress is installed in (and its sub-directories). You're seeing an error because your web server doesn't have the proper privileges to write to your directories.I recommend running achown -R user:group /path/to/wordpress, substituting theuserandgr... |
How to connect frontend to backend via docker-compose networks | I'm trying to dockerize my angular + express application. I have a docker-compose file that creates the two containers, and I am able to hit the containers from my host machine(using my browser), but I'll just get a "ERR_NAME_NOT_RESOLVED" whenever I try to hit the backend from http requests made by my frontend.I've lo... | In fact your traffic is as next:User browser request page fromangular container, then all pages will rendered to user's browser.The front javascript code usingangular HttpClientto fetch the data fromexpress container.At that time, althoughdocker-composesetup a customized network for you which afford auto-dns to resolve... |
run a script when a new veth interface is added | Docker creates avethinterface connected to a bridge (docker0) for each of the containers it create.http://docs.docker.io/use/networking/I want to limit the bandwidth these newvethinterfaces have. I found a way to do this with wondershaper. However I want to automate this.Is there a way to have a hook that runs a script... | You should write a customudevrule that runs a script of yours each time a new interface is added. This is what Debian does for handling interface "hotplug"./etc/udev/rules.d/90-my-networking.rules:SUBSYSTEM=="net", RUN+="/usr/local/bin/my-networking-agent.sh"/usr/local/bin/my-networking-agent.sh:#!/bin/sh
log... |
forward udp multicast from eth0 to docker0 | I have a docker container running a java application which is listening for UDP multicast packets. I am not receiving the packets inside the container, however they appear on the host machine on eth0.Is there a way for docker to automatically pick up these packets and forward them to the container?Thanks | After a lot of frustrating days of trying out a number of things... finally something worked:Using Pipework (https://github.com/jpetazzo/pipework), the following command worked but there is a catch -pipework eth2 $(docker run -d hipache /usr/sbin/hipache) 50.19.169.157/24running a docker container by only running the a... |
How can I set path to load data from CSV file into PostgreSQL database in Docker container? | I would like to load data from CSV file into PostgreSQL database in Docker.
I run:docker exec -ti my project_db_1 psql -U postgresThen I select my database:\c myDatabaseNow I try to load data frommyfile.csvwhich is in the main directory of the Django project intobackend_datatable:\copy backend_data (t, sth1, sth2) FROM... | The easiest way is to mount a directory into the postgres container, place the file into the mounted directory, and reference it there.We are actually mounting thepgdatadirectory, to be sure that the postgres data lives even if we recreate the postgres docker container. So, my example will also usepgdata:services:
db... |
Docker TLS error on Mac | I randocker imagesand got the following error:FATA[0000] Get http:///var/run/docker.sock/v1.17/images/json:
dial unix /var/run/docker.sock: no such file or directory.
Are you trying to connect to a TLS-enabled daemon without TLS?There seems to be no useful message on how to fix the error. What could be wrong? | https://docs.docker.com/installation/mac/you need to do thisonce:boot2docker initthen, everytime you reboot your mac you will need to run :boot2docker startThat is the command that starts the docker daemon. But, on each shell you want to access it from you will need to run:$(boot2docker shellinit)Now you can use the d... |
How to remount the /proc filesystem in a docker as a r/w system? | I have installed docker 0.11.1 over Ubuntu 12.04.
I am trying to change the shmmax from its fixed value (32 M) to something bigger (1G)
from within the docker when I run the command:sysctl -w kernel.shmmax=1073741824
error: "Read-only file system" setting key "kernel.shmmax"That is because/procis mountedroin the contai... | If the goal is to set sysctl settings, docker has realized the issue and in 1.12+ you can use the --sysctl flag when running a docker container (or in your compose file) which will set the values inside the container before it is run.This is sadly not (yet) integrated yet in the dockerfile syntax.https://docs.docker.co... |
How to resolve docker host names (/etc/hosts) in containers | how is it possible to resolve names defined in Docker host's /etc/hosts in containers?
Containers running in my Docker host can resolve public names (e.g. www.ibm.com) so Docker dns is working fine.
I would like to resolve names from Docker hosts's (e.g. 127.17.0.1 smtp) from containers.My final goal is to connect to s... | Check out the--add-hostflag for thedockercommand:https://docs.docker.com/engine/reference/run/#managing-etchosts$ docker run --add-host="smtp:127.17.0.1" container commandIn Docker,/etc/hostscannot be overwritten or modified at runtime (security feature). You need to use Docker's API, in this case--add-hostto modify th... |
Set up nginx proxy for react application | I'm trying to create a docker-compose using two services, a Spring Boot backend (running on port 8080) and React frontend running on Nginx.The react app calls backend API like /api/tests.
However, when I run the docker compose and frontend makes a request, it always fails with 404 error:GET http://localhost/api/tests 4... | I found the problem. In the multi-stage build of the docker image, I accidentally copied the nginx.conf file into the builder image, not the production one.The fixed Dockerfile now looks like this:# build environment
FROM node:11.13 as builder
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
ENV PATH /usr/src/app/node_mod... |
Kubernetes - Readiness Probe execution after container started | Is there a way to prevent readiness probe from execution once container has successfully started? I suppose that liveness probe should be enough to monitor container health. | The readiness and liveness probes serve slightly different purposes.The readiness probe controls whether the pod IP is included in the list of endpoints for a service, and so also whether a target for a route when it is exposed via an external URL.The liveness probe determines whether a pod is still running normally or... |
Docker - Run Container from Inside Container | I have two applications:a Python console script that does a short(ish) task and exitsa Flask "frontend" for starting the console app by passing it command line argumentsCurrently, the Flask project carries a copy of the console script and runs it usingsubprocesswhen necessary. This works great in a Docker container but... | You can just give the container access to execute docker commands. It will either need direct access to the docker socket or it will need the various tcp environment variables and files (client certs, etc). Obviously it will need adocker clientinstalled on the container as well.A simple example of a container that can ... |
`/bin/sh: 1: python: not found` when run via cron in docker | I want to repeatedly call a script via cron in a docker container, but when I switch from one time execution to execution via cron the official python image suddenly can't seem to find python.Dockerfile:FROM python:3.7-slim
COPY main.py /home/main.py
#A: works
CMD [ "python", "/home/main.py" ]
#B: doesn't work
#RUN ... | Cron doesn't set up thePATHenvironment variable the same as a normal login shell sopythoncan't be found. It should work if you specify a complete path to the Python executable, e.g. replacepythonwith/usr/bin/python(or whatever the path to your Python executable happens to be). Alternatively you can explicitly set thePA... |
RUN pip install: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed [duplicate] | This question already has answers here:pip install fails with "connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)"(60 answers)Closed4 years ago.Following the lab from [GitHub][1] to learn more about Docker containers, I felt in this problem:No matching distribution found for Flask... | The problem is related to the fact that I'm in a network behind a BlueCoat (kind of firewall) which inspect and hide almost of the communication from my desktop and the internet.After fell googles seach I've found the command to ignore the certificat problem:Just add this to my dockerfile--trusted-host pypi.org --trust... |
How to access webserver running in docker container from browser? | I'm trying to deploy theMDT(Mobile Distribution Tool)on my local Mac.I'm using docker and have managed to get the container running..In the image you can see MDT running on port 4000. But when I browse to my machine browser on "localhost:4000", I get a timeout.I've gone throughthispost and tried to add a route, but did... | When publishing a container port eg 8080:8080 (host_port:container_port).. Make sure the container port is the same on which your web service is running...My webserver was listening for connections on 8080 port and in the screenshot as you can see.. I have given 4000 port |
What is tail command with docker run entrypoint in visual studio 2019? | I am running Windows 10 pro, docker installed and linux containers.With Visual Studio 2019, I created a basic .net core web api app, and enabled docker support(linux).I built the solution, and in the output window (View -> Output or Ctrl + Alt + O) I selected "Container Tools" in the Show Output From drop down. Scroll ... | Entrypoint is the binary that is being executed.Example:--entrypoint=bash--entrypoint=helmlike this.Thetaillinux utility displays the contents of file or, by default, its standard input, to the standard output/dev/null./dev/nullredirects the command standard output to the null device, which is a special device which di... |
How to configure kubernetes (microk8s) to use local docker images? | I've build docker image locally:docker build -t backend -f backend.dockerNow I want to create deployment with it:apiVersion: apps/v1
kind: Deployment
metadata:
name: backend-deployment
spec:
selector:
matchLabels:
tier: backend
replicas: 2
template:
metadata:
labels:
tier: backend
... | Found docs on how to use private registry:https://microk8s.io/docs/workingFirst it needs to be enabled:microk8s.enable registryThen images pushed to registry:docker tag backend localhost:32000/backend
docker push localhost:32000/backendAnd then in above configimage: backendneeds to be replaced withimage: localhost:3200... |
How to use custom Nginx config for official nginx Docker image? | I have nextdocker-composefile:nginx:
build: .
ports:
- "80:80"
- "443:443"
links:
- fpm
fpm:
image: php:fpm
ports:
- "9000:9000"TheDockerfilecommand list is:FROM nginx
ADD ./index.php /usr/share/nginx/html/
# Change Nginx config here...The Nginx server work fine and... | You can create a very simpledockerimage containing your custom nginx configuration and mount this volume in the container that uses original nginx image.There are just a few steps to follow.1. Create your custom nginx config image projectmkdir -p nginxcustom/conf
cd nginxcustom
touch Dockerfile
touch conf/custom.conf2.... |
Remove port binding from an existing docker container | Currently I have a container created withdocker run --detach --name gitlab_app --restart=always --publish 192.168.0.200:80:80 --publish 192.168.0.200:22:22 --volumes-from gitlab_data gitlab_imageI want to remove both port bindings80and22from the image. Is it possible to remove port binding from an existing docker conta... | If its ok for the container to be offline why not just remove and run again without the port switches?If you do need to do this without deleting containers you could just modify the underlying iptables changes.# Will list the rules
iptables -L
# Will delete the rule you want to remove
iptables --delete [chain] In gene... |
Build started failing using Python:3.8 Docker image on apt-get update and install with GPG error: bookworm InRelease is not signed | My build pipeline has stopped working all of a sudden which was working fine a few weeks ago. I'm using Dockerfile to build my app withpython:3.8as the base image. It has started failing on theapt-get update && apt-get installpart. I didn't change anything in the Dockerfile.My Dockerfile looks like this:FROM python:3.8... | Why this happened?The Python docker images have been updated recently to use Debian 12bookwormversion which was released on 10 June 2023 instead of Debian 10buster.Sources:GitHub > docker-library/python > Commit > add bookworm, remove busterWikipedia > Debian version history > Release tableWhat is the root cause?It is ... |
How to automate a docker run from a private Dockerhub repo? | I have a EC2 server running Docker and I'd like to add the following to theUser Dataso my private Dockerhub images will be pulled/run when the server starts up, like so:#!/bin/bash
sudo docker run -p 3333:3333 -d --name Hello myusername/helloBut I'm unsure as to how to go about authenticating in order to gain access to... | UPDATE:Figured out an even better way that doesn't involve baking your creds into an image at all. See the following question for information that would be applicable to solving this problem as well:Is it secure to store EC2 User-Data shell scripts in a private S3 bucket?This helps keep your secrets in the least number... |
nslookup can not get service ip on latest busybox | Reproduce steps:kubectl run busybox1 --generator=run-pod/v1 --image=busybox:1.28 -- sleep 3600kubectl run busybox2 --generator=run-pod/v1 --image=busybox:1.31.1 -- sleep 3600kubectl exec -ti busybox1 -- nslookup kubernetes.defaultworks fineServer: 10.96.0.10Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.loca... | DNS inside busybox only works correctly in images <= 1.28.4.Fixing the versionimage: "busybox:1.28.0"should do the trick.There's a thread herehttps://github.com/kubernetes/kubernetes/issues/66924 |
starting container process caused "exec: \"/app\": permission denied": unknown | When I was trying to build golang using dockerThe image build of docker was successful, but the following error occurred when running with docker rundocker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"/app\": permission denied": unknown.I thi... | You are copying your entire source folder into the directory/appin this step:COPY --from=builder /go/src/ /appThen you try to execute the directory:ENTRYPOINT [ "/app" ]Instead, you need to copy the compiled binary that your go build outputs in the copy step. |
Getting Docker for mac proxy variables through terminal | I am using Docker for mac behind a proxy. I set up the proxy configuration in the Docker GUI under "Proxies" -> "Manual proxy configuration". This lets me download Docker images from the repository behind the proxy.Next, I set thehttp_proxyandhttps_proxyenvironment variables and I use them in my docker-compose.yml to p... | If I understood correctly want you want, then you just need to read what's given bydocker info:❯ docker info | grep Proxy
Http Proxy: http://localhost:3128
Https Proxy: http://localhost:3128If these two are set in the GUI, they will appear near the end of the output. If they are not set, they won't, and in my case,No P... |
Dynamic Docker base image | I have a Dockerfile that needs to get base image tag from the command line and load it dynamically, but I am getting this error with this command line.$ docker build --network=host --build-arg sample_TAG=7.0 --rm=true .
Step 9/12 : FROM "${sample_TAG}"
base name ("${sample_TAG}") should not be blankThe Dockerfile:FRO... | For that, you need to define Global ARGs and better to have some default value and override it during build time.ARG sample_TAG=test
FROM maven:3.6.1-jdk-8 as maven-build
ARG sample_TAG
WORKDIR /apps/sample-google
RUN echo "image tag is ${sample_TAG}"
FROM $sample_TAG
VOLUME /apps
RUN mkdir /apps/sample-google |
Is there a docker registry cluster solution for private purpose? | I am looking for an open source solution to sync several docker registries. Could anybody give me some hints about this? | The easiest way to set up a docker registry is using theofficial docker registry. This allows you to easily run a registry server with a configurable storage backend. As others have mentioned you can use S3 or Google Cloud storage. (I have personally used Google Cloud storage and have not run into any problems).I would... |
how to integrate cmake in gitlab repository for Continuous Integration(CI) | I was able to run the C++ Program and build & test it using GitLab CI unit with the help of Docker Image of gcc. But now I want to compile the program in docker usingcmakeinstead of g++. How to change the '.gitlab-ci.yml' file to support cmake.Current File : .gitlab-ci.ymlimage: gcc
before_script:
- apt-get install ... | I think you need to add apt-get update in order to get cmake to install. Seethisimage: gcc
before_script:
- apt-get update --yes
- apt-get install --yes cmake
build:
script:
- ./runner.sh
- ./bin/helloIn general, you can figure stuff out by jumping into the docker image to debug (in your case the image is ... |
Limit JVM memory consumption in a Docker container | I've got a Spring Boot application implementing a service which I want to run in a Docker container. I've followed the guideline of the officialSpring docswhich suggest to create a DockerFile similar to this:FROM frolvlad/alpine-oraclejdk8:slim
VOLUME /tmp
ADD gs-spring-boot-docker-0.1.0.jar app.jar
RUN sh -c 'touch /a... | After struggling for a while, it seems theJAVA_OPTSvariable can be passed to the containerwhen it's based in a Tomcat image, but Spring Boot uses Java itself as the base image.I've found outthis tutorialwhich solved the problem for me, just modifying the way the process is launched in the DockerFile and adding a JAVA_O... |
Register to Eureka from Docker with a custom IP | I'm running Spring Cloud Eureka inside my Docker VM. I have services registering to it, but they use their IP adress from inside the Docker VM, but to be able to use them properly i need them to use the IP adress i can access from outside the VM.For example inside my VM the register using 172.x.x.x and i can access the... | You can configure it in yourapplication.yml:eureka:
instance:
ipAddress: 192.168.x.x |
How do I write a dockerfile to execute a simple bash script? | I'm trying to write a docker image to run a simple webserver though netcat.So I have in my docker build folder:Dockerfile
index.html
run_netcat_webserver.shTherun_netcat_webserver.shis very simple and it works fine:#!/bin/bash
while true ; do nc -l 8080 < index.html ; doneHere is my naive Dockerfile that of course is... | You need to make the script part of the container. To do that, you need to copy the script inside using theCOPYcommand in the Docker file, e.g. like thisFROM ubuntu:14.04
COPY run_netcat_webserver.sh /some/path/run_netcat_webserver.sh
CMD /some/path/run_netcat_webserver.shThe/some/pathis a path of your choiceinsidethe ... |
Kubernetes: Unable to create repository | I'm followingKubernete's getting started guide. Everything went smoothly until I ran$ gcloud docker push gcr.io//hello-node:v1(Where is, well, my project id). For some reason, Kubernetes is not able to push to the registry. This is what I get:Warning: '--email' is deprecated, it will be removed soon. See usage.
Login ... | Edit: This worked for me months ago. New versions of Kubernetes might not have this problem, or this solution might not solve it :)Ok, after struggling for hours with this, I finally managed to push it to th grc.io registry by changing my tag from aimage:versionnotation toimage/version, like this:gcloud docker push gcr... |
Can Docker Engine start containers in parallel | If I have scripts issueing docker run commands in parallel, the docker engine appears to handle these commands in series. Since runing a minimal container image with "docker run" takes around 100ms to start does this mean issueing commands in parallel to run 1000 containers will take the docker engine 100ms x 1000 = 1... | How do people get around this?a/ They don't start 1000 containers at the same time
b/ if they do, they might use acluster management system like docker swarmto manage the all process
c/ they do run 1000 containers, in advance in order to take into account the starting time.Truly parallelizedocker runcommand could be tr... |
Useless Amazon ECS Error Message when creating tasks | Using theecs agent containeron an Ubuntu instance, I am able to register the agent with my cluster.I also have a service created in that cluster and task definitions as well. When I try to add a task to the cluster I get the useless error message:Run tasks failed
Reasons : ["ATTRIBUTE"]The ecs agent log has no related... | From thetroubleshooting guide:ATTRIBUTE (container instance ID)Your task definition contains a parameter that requires a specific container instance attribute that is not available on your container instances. For more information on which attributes are required for specific task definition parameters and agent config... |
Docker MySQL: create new user | In themysql docker hub pagethere's a reference on how to create users with:MYSQL_USER, MYSQL_PASSWORDBut how can you specify those parameters on the docker-compose.yml file?So far I have:mysql:
image: mysql:5.7
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: R00t+Another question; how can I connect... | About password you are setting all parameters exactly the same as you set root password which is:mysql:
image: mysql:5.7
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: R00t+
MYSQL_USER: youruser
MYSQL_PASSWORD: yourpasswordTo connect with mysql outside container just as host uselocalhostbe... |
Docker compose reusing volumes | I'm trying to create a new Docker image that no longer uses volumes from a running container that does use images. The volumes were created using docker-compose file, not Dockerfile. The problem is, when I launch a new container via new docker-compose.yml file it still has the volumes mapped. I still need to keep these... | According to another SO post what I am trying to do is not possible. For future reference, one cannot attach volumes to an image, and then later decide to remove them. A new image must be created without the volumes instead. Reference:How to remove configure volumes in docker images |
Unable to locate file in docker container | I'm new to docker and creating a simple test app to test my docker container, but docker unable to locate theserver.pyfile.The directory structure of my project is:
|
|-- Dockerfile
|-- app
|
|-- requirements.txt
|-- server.pyBelow is theDockerfilecontent:FROM ubuntu:latest
MAINTAINER name <[email pr... | You're copying your local/app/folder to the/app/folder in the running Docker container (as mentioned in the comments) creating/app/app/server.pyin the Docker container.How to resolveA simple fix will be to changeCOPY . /apptoCOPY ./app/server.py /app/server.pyExplanationThe commandCOPYworks as follows:COPY You're sele... |
Docker tomcat edit expanded war files | I am using docker to deploy a tomcat container running a third partywarfile.MyDockerfilelooks something like thisFROM tomcat:7-jre8
ADD my.war ${CATALINA_HOME}/webapps/my.warWhen I run the container tomcat expands mywarat runtime and I can happily access my app athttp://my.ip.addr:8080/mywar/.However my problem is tha... | I am not sure exactly how you would achieve it with docker or anything else, as i dont see anyway to ask tomcat to just expand the war before it actually starts. But as per standard practices its not a good idea to explode a war and tweak the contents. It kills the entire purpose of making a war.Rather you should make ... |
docker run entrypoint with multiple commands | How can I have an entrypoint in adocker runwhich executes multiple commands?
Something like:docker run --entrypoint "echo 'hello' && echo 'world'" ... The image I'm trying to run, has already an entrypoint set in the Dockerfile, so solution like the following seems not to work, because it looks my commands are ignored,... | As a style point, this gets vastly easier if your image has aCMDthat can be overridden. If you only need to run one command with no initial setup, make it be theCMDand not theENTRYPOINT:CMD ./some_command # not ENTRYPOINTIf you need to do some initial setup and then launch the main command, make theENTRYPOINTbe a she... |
Multiple vhosts on one and the same docker container | I'm trying to run two different domains on one and the same Docker container and port.The Docker container runs CentOS.docker-compose.ymllooks like so:web:
image: fab/centos
ports:
- "80:80"
volumes:
- ./src/httpd.conf:/etc/httpd/conf/httpd.conf
- ./src:/var/www/html
- ./src/hosts:/etc/hosts
env... | Turns out this was an Apache configuration issue.I needed to explicitly enable domain-named virtualhosts, like so:NameVirtualHost *:80This answer helped.Docker had nothing to do with the matter. |
Running DBT within Airflow through the Docker Operator | Building my question onHow to run DBT in airflow without copying our repo, I am currently running airflow and syncing the dags via git. I am considering different option to include DBT within my workflow. One suggestion bylouis_guittonis to Dockerize the DBT project, and run it in Airflow via theDocker Operator.I have ... | Judging by your questions, you would benefit from trying to dockerise dbt on its own, independently from airflow. A lot of your questions would disappear. But here are my answers anyway.Should DBT as a whole project be run as one Docker container, or is it broken down? (for example: are tests ran as a separate containe... |
Docker - Build rpi image on Mac | This could be more generic and be building an image for architecture B with a machine architecture A. I currently want to create an image with lot of Python dependencies. Which take time on raspberry-pi but is faster on Mac. When I get an error at the end well need to rebuild. Is there a way to build this image on Mac ... | Emulating a full alternate architecture is generally very slow.QEMUis what allows you to do this on Linux and can be integrated into a Docker container.For building, you can useQEMU User Emulationwhich is much quicker than full emulation. This allows your hardware to execute ARM binaries directly and is used to ease cr... |
Docker best practices: single process for a container | The Dockerbest practicesguide states that:"...you should only run a single process in a single container..."Should Nginx and PHP-FPM run in separate containers? Or does that mean that micro service architectures only run one service or "app" in a container?Having these services in a single container seems easier to dep... | Depending on the use case, youcanrun multiple processes inside a single container, although I won't recommend that.In some sense it is even simpler to run them in different containers. Keeping containers small, stateless, and around a single job makes it easier to maintain them all. Let me tell you how my workflow with... |
'docker run -v' does not work on Windows using Docker Toolbox | When running the following command from a CoreOS VM, it works as expected:docker run --rm -v $PWD:/data composer initIt will initialize thecomposer.jsonfile in the current working directory by using the Docker volume mapping as specified. The Docker container basically has the PHP tool composer installed and will run t... | This should work:$ docker run --rm -v //c/Users/Marco:/data composer --help |
Assigning IP address to docker containers? | I'm new to Docker. Is it possible to assign an IP address (from a DHCP server) to Docker containers running on a host or VM? If yes, can someone point me in the correct direction. If no, is it a fundamental limitation of the container approach or it's just a feature that's not in Docker yet. | Caveat - Docker is under heavy development so confirming against current docs is advisable.The network element is one of those under current discussion ondocker-dev, it looks like longer term integration withlibvirtis being considered. So to answer your question NET DHCP or something is probably not implemented as you'... |
How to manage AWS credentials when running Docker container with Visual Studio 2017 | I have a .NET Core 2.0 console application developed using Visual Studio 2017. The launchSettings.json file sets an environment variable that allows it to use the developer's default AWS credentials"environmentVariables": {
"AWS_PROFILE": "default"
...
}I have now added Docker support to the VS solution, and am tr... | The solution I went for was to edit thedocker-compose.override.ymlfile that was added by Visual Studio Tools for Docker, and add the following lines:version: '3'
services:
mydockerapp:
volumes:
- ${USERPROFILE}/.aws:/root/.aws
environment:
- AWS_REGION=(your region)
- AWS_PROFILE=defaultThi... |
Connection refused while connecting to upstream when using nginx as reverse proxy | The setup is as follows: I have a Gunicorn/Django app running on0.0.0.0:8000that is accessible via the browser. To serve static files I am running nginx as a reverse proxy./etc/nginx/nginx.confis configured to forward requests as follows:server {
location /static/ {
alias /data/www/;
}
# Proxying ... | Change your proxy_pass fromproxy_pass http://0.0.0.0:8000;toproxy_pass http://web:8000;Your nginx needs to forward to request the web containerEdit-1: Explanation0.0.0.0is a special IP address which is used to refer to any available interface on the machine. So if your machine has a loopback (lo), ether... |
Docker ubuntu cron tail logs not visible | Trying to run a docker container that has a cron scheduling. However I cannot make it output logs.Im using docker-compose.docker-compose.yml---
version: '3'
services:
cron:
build:
context: cron/
container_name: ubuntu-croncron/DockerfileFROM ubuntu:18.10
RUN apt-get update
RUN apt-get update && apt-ge... | Due to some weirdness in the docker layers and inodes, you have to create the file during the CMD:CMD cron && touch /var/log/cron.log && tail -F /var/log/cron.logThis works both for file and stdout:FROM ubuntu:18.10
RUN apt-get update
RUN apt-get update && apt-get install -y cron
ADD hello-cron /etc/cron.d/hello-cron... |
Running mongorestore on Docker once the container starts | I'm trying to set up a container running MongoDB that gets populated with data using mongorestore when it starts up. The idea is to quickly set up a dummy database for testing and mocking.My Dockerfile looks like this:FROM mongo:bionic
COPY ./db-dump/mydatabase/* /db-dump/and docker-compose.yml looks like this:version:... | There is a better way than overriding the default command - using/docker-entrypoint-initdb.d:When a container is started for the first time it will execute files with extensions.shand.jsthat are found in/docker-entrypoint-initdb.d. Files will be executed in alphabetical order..jsfiles will be executed by mongo using th... |
Maven Spring Boot Cannot Push Docker Image | Using Spring Boot 2.4.0, I'm trying to configure thespring-boot:build-imagetask to push an image to my private GitHub container registry.I usedthese instructionsto configure my POM as follows:
org.springframework.boot
spring-boot-maven-plugin
ghcr.io/abc/${project.artifactId}:${project.version}
true
abc
mytoken
htt... | In case anyone else finds this, the problem ended up being a typo in the maven plugin configuration. I was usinginstead of. Below is the correct XML that works:
abc
mytoken
https://ghcr.io
|
How to setup unit test in Docker for nodejs application? | I am trying to run mocha unit test for my node application. The application is built by a docker image.Docker image:FROM node:6.10.0-alpine
RUN mkdir -p /app
WORKDIR /app
COPY package.json /app
RUN npm install
COPY . /app
EXPOSE 3000
CMD ["npm", "start"]Docker compose:version: "3"
services:
web: #### nodejs image... | Withdocker(anddocker-compose), you can run arbitrary commands in a container. TheDockerfiledefines the default command that is run when no other command is specified, but that doesn't mean it's the only one you can run.In your case:npm startis run when no other command is specified. That happens when you dodocker-compo... |
Typescript compilation fails (in Docker) when NODE_ENV=production | So I have acreate-react-app-tsapp that I would like to Dockerize and host on Zeit Now.Everything works fine locally, runningyarn tscandreact-scripts-ts buildworks great.Creating the Docker image also works great from the following Dockerfile:FROM mhart/alpine-node:10.9
WORKDIR /usr/src
ARG REACT_APP_API_ENDPOINT
ARG N... | So I finally found the issue! In my originalDockerfile,NODE_ENVwas setbeforeyarn install. This means that for the production build,yarnwould not installdevDependencies, and therefore not any of my@typeslibraries. This caused all the compilation errors all over the project.Moving the definition ofNODE_ENVbelow/afteryarn... |
setting up docker permission to VSTS agent in a private pipeline | I have set a private pipeline with linux vm and agent is install and in the portal it shows that the agent is active. I also have install docker. In the same machine if I use sudo docker it works. So I am sure it is a permission issues when the VSTS agent is running the command. Not sure what which user i need to give ... | In VSTS, it's the build service account which execute entire build pipeline. This account should also run the command.Note, the service is setting up during the configuration of build agent. You can run the build agent as a systemd service. More details please refer to thistutorial.You will need to grant appropriate p... |
Node.js docker container not updating to changes in volume | I am trying to host a development environment on my Windows machine which hosts a frontend and backend container. So far I have only been working on the backend. All files are on the C Drive which is shared via Docker Desktop.I have the following docker-compose file and Dockerfile, the latter is inside a directory call... | The difference between node and PHP here is that php automatically picks up file system changes between requests, but a node server doesn't.I think you'll see that the file changes get picked up if you restart node by bouncing the container with docker-compose down then up (no need to rebuild things!).If you want node ... |
Docker RUN multiple instance of a image with different parameters | I am new to docker, so this may sound a bit basic question.I have a VS.Net core2 console application that is able to take some commandline parameters and provide different services. so in a normal command prompt I can run something likec:>dotnet myapplication.dll 5000 .\mydb1.db
c:>dotnet myapplication.dll 5001 .\myd... | Docker containers are started with an entrypoint and a command; when the container actually starts they are simply concatenated together. If the ENTRYPOINT in theDockerfileis structured like a single command then the CMD in theDockerfileorcommand:in thedocker-compose.ymlcontains arguments to it.This means you should b... |
Selenium upload file: file not found [docker] | I have following method that uploads image using selenium.public static void uploadSampleImage(StaticSeleniumDriver driver)
{
File file = new File(System.getProperty("user.dir") + "/resources/images/" + SAMPLE_DOCUMENT_FILE_NAME);
Utils.Log("file exists: " + file.exists());
String imagePath = file.getAbsol... | ForRemoteWebDriveryou have to set file detectordriver.setFileDetector(new LocalFileDetector());.
Your code:public static void uploadSampleImage(StaticSeleniumDriver driver)
{
driver.setFileDetector(new LocalFileDetector());
File file = new File(System.getProperty("user.dir") + "/resources/images/" + SAMPLE_DOC... |
Service notebook has neither an image nor a build context specified. At least one must be provided | I want to usejupyter/base-notebook:latestimage. Here is mydocker-compose.yml:version: "3.7"
services:
notebook:
image: jupyter/base-notebook:latest
build:
args:
- NB_USER=appuser
- NB_UID=1001
- NB_GID=101
ports:
- "3010:8888"
volumes:
- "./notebooks:/home/ap... | There are 2 options: use an existing imageORtell the docker-compose to build it. If both are specified, then Compose names the built image with thejupyter/base-notebook:latest.If you want to use thejupyter/base-notebook:latestimage as is, remove thebuild:section from your compose file and keep theimage::version: "3.7"
... |
docker-compose - database migrations and other pre/post scripts | I have a sample django app that I am trying to get up and running using docker.docker-compose upbrings up the web, db and other containers along with links between them. But there are pre and post scripts that might need to be run..example of pre-scripts in my scenario:git
pip
docker
docker-compose
wgetexample of post-... | You have two options:You can run these commands in the dockerfile for your images; as each dockerfile is run when compose is running - your images will have the results of these commands. This is particularly useful when you are doing os-level upgrades and configuration bootstrapping (like yourapt-getcommands).For run... |
How to make FASTAPI pickup changes in an API routing file automatically while running inside a docker container? | I am running FastApi via docker by creating a sevice called ingestion-data in docker-compose. My Dockerfile :FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
# Environment variable for directory containing our app
ENV APP /var/www/app
ENV PYTHONUNBUFFERED 1
# Define working directory
RUN mkdir -p $APP
WORKDIR $APP
C... | Quick answer: Yes :)In the Dockerfile, you copying your app into /var/www/app.The instructions form the Dockerfile are executed when you build your image (docker build -t :)If you change the code later on, how could the image be aware of that?However, you can mount a volume(a directory) from your host machine, into the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.