Docker loading kernel modules

In Linux host: Run the container in privileged mode (–privileged) Add all capabilities (–cap-add=ALL) mount host /lib/modules into the container (-v /lib/modules:/lib/modules) docker run –name container_name \ –privileged \ –cap-add=ALL -d \ -v /dev:/dev \ -v /lib/modules:/lib/modules \ image_id Caution: Here all Linux capabilities are added so capabilities can be refined. Few words about Linux … Read more

Substitute environment variables in NGINX config from docker-compose

Since nginx 1.19 you can now use environment variables in your configuration with docker-compose. I used the following setup: # file: docker/nginx/templates/default.conf.conf upstream api-upstream { server ${API_HOST}; } # file: docker-compose.yml services: nginx: image: nginx:1.19-alpine volumes: – “./docker/nginx/templates:/etc/nginx/templates/” environment: NGINX_ENVSUBST_TEMPLATE_SUFFIX: “.conf” API_HOST: api.example.com I’m going off script a little from the example in the documentation. … Read more

Docker add network drive as volume on windows

My colleague came up with this and it works with our company network drive and it might help someone out there. We start by creating a docker volume named mydockervolume. docker volume create –driver local –opt type=cifs –opt device=//networkdrive-ip/Folder –opt o=user=yourusername,domain=yourdomain,password=yourpassword mydockervolume –driver specifies the volume driver name –opt Sets driver specific options. I guess … Read more

Mount directory in Container and share with Host

After countless hours of research, I decided to extend my image with the following Dockerfile: FROM sphinxsearch VOLUME /usr/local/sphinx/etc VOLUME /usr/local/sphinx/var RUN mkdir -p /sphinx && cd /sphinx && cp -avr /usr/local/sphinx/etc . && cp -avr /usr/local/sphinx/var . ADD docker-entrypoint.sh / RUN chmod +x /docker-entrypoint.sh ENTRYPOINT [“/docker-entrypoint.sh”] Extending it benefited it me in that I … Read more