Docker container cannot resolve hosts

By default creating a new docker container also creates a virtual network that separates the docker network environment from the host network environment (somewhat). This allows one to easily spin up multiple containers which might all listen on the same port (e.g. 80), but in a way that can be mapped to unique ports on … Read more

Docker mongodb config file

I’m using the mongodb 3.4 official docker image. Since the mongod doesn’t read a config file by default, this is how I start the mongod service: docker run -d –name mongodb-test -p 37017:27017 \ -v /home/sa/data/mongod.conf:/etc/mongod.conf \ -v /home/sa/data/db:/data/db mongo –config /etc/mongod.conf removing -d will show you the initialization of the container Using a docker-compose.yml: … Read more

Using current user when running container in docker-compose

Building on top of the answer by Joepreludian, focusing on docker-compose: You can use the user: and volumes: options in the compose file. For example: my-service: image: ubuntu:latest user: ${MY_UID}:${MY_GID} volumes: – /etc/passwd:/etc/passwd:ro – /etc/group:/etc/group:ro and define these variables where you are starting your compose: MY_UID=”$(id -u)” MY_GID=”$(id -g)” docker-compose up

Enable Ingress controller on Docker Desktop with WLS2

Finally I found the way to fix. I have to deploy ingress Nginx by command: kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.41.2/deploy/static/provider/cloud/deploy.yaml (Follows the instruction at https://kubernetes.github.io/ingress-nginx/deploy/#docker-for-mac. It works just fine for Docker for Windows) Now I can access http://ingress.local successfully.

Running headless Chrome / Puppeteer with –no-sandbox

I was hitting a similar problem trying to run Chromium headless in an Alpine Docker container, and apparently so are many other (e.g., here, here). The –no-sandbox option is a straightforward workaround but obviously a poor security practice. What worked for me was setting a custom seccomp. Download this file (if interested, see the author’s … Read more

RUN inside a conditional statement in Dockerfile

Use only one ‘RUN’ statement. It’s a best practice as it will reduce the size taken by your image. This is how you can pass an argument to docker build. Dockerfile: … ARG NEW COPY ./compose/local/django/new.sh /new.sh COPY ./compose/local/django/start.sh /start.sh RUN if [ “$NEW” = “True” ]; then \ sed -i ‘s/\r//’ /new.sh && \ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)