Go-compiled binary won’t run in an alpine docker container on Ubuntu host

By default, if using the net package a build will likely produce a binary with some dynamic linking, e.g. to libc. You can inspect dynamically vs. statically link by viewing the result of ldd output.bin There are two solutions I’ve come across: Disable CGO, via CGO_ENABLED=0 Force the use of the Go implementation of net … Read more

Copying files from Docker container to host

In order to copy a file from a container to the host, you can use the command docker cp <containerId>:/file/path/within/container /host/path/target Here’s an example: $ sudo docker cp goofy_roentgen:/out_read.jpg . Here goofy_roentgen is the container name I got from the following command: $ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1b4ad9311e93 … Read more

Where to put the php artisan migrate command

This is how I solved it .Created a bash script called run.sh and added the php artisan migrations commands followed by the php serve command. run.sh #!/bin/sh cd /app php artisan migrate:fresh –seed php artisan serve –host=0.0.0.0 –port=$APP_PORT Added entrypoint to the Dockerfile removing the CMD in the end which will run the commands desired. … Read more

What are shell form and exec form?

The docker shell syntax (which is just a string as the RUN, ENTRYPOINT, and CMD) will run that string as the parameter to /bin/sh -c. This gives you a shell to expand variables, sub commands, piping output, chaining commands together, and other shell conveniences. RUN ls * | grep $trigger_filename || echo file missing && … Read more

How to create a Mongo Docker Image with default collections and data?

The problem was that information could not be saved on /db/data, so I’ve created a solution creating my own data directory. # Parent Dockerfile https://github.com/docker-library/mongo/blob/982328582c74dd2f0a9c8c77b84006f291f974c3/3.0/Dockerfile FROM mongo:latest # Modify child mongo to use /data/db2 as dbpath (because /data/db wont persist the build) RUN mkdir -p /data/db2 \ && echo “dbpath = /data/db2” > /etc/mongodb.conf \ … Read more

Unable to bind to http://localhost:5000 on the IPv6 loopback interface: ‘Cannot assign requested address’

To workaround the issue, add the code ENV ASPNETCORE_URLS=http://+:80 below the other ENV declarations at the top of the Dockerfile.develop file Dockerfile.develop after: FROM mcr.microsoft.com/dotnet/core/sdk:3.1 ARG BUILD_CONFIGURATION=Debug ENV ASPNETCORE_ENVIRONMENT=Development ENV DOTNET_USE_POLLING_FILE_WATCHER=true ENV ASPNETCORE_URLS=http://+:80 EXPOSE 80 Explanation Server URLs is one of the ASP.NET Core Web Host configuration values. It uses the environment variable ASPNETCORE_URLS and … Read more

How to install extension for php via docker-php-ext-install?

I had the same problem a while ago. I started a container and typed the ext-install command into this container. Once I found all the dependencies, I wrote them into the Dockerfile. Example: RUN apt-get update && apt-get install -y \ libmcrypt-dev \ && docker-php-ext-install -j$(nproc) mcrypt There is a dependency that libmcrypt-dev needed before … Read more

Clean docker environment: devicemapper

Don’t use a devicemapper loop file for anything serious! Docker has big warnings about this. The /var/lib/docker/devicemapper/devicemapper directory contains the sparse loop files that contain all the data that docker mounts. So you would need to use lvm tools to trawl around them and do things. Have a read though the remove issues with devicemapper, … Read more

What work does the process in container “gcr.io/google_containers/pause:0.8.0” do?

In Kubernetes, each pod has an IP and within a pod there exists a so called infrastructure container, which is the first container that the Kubelet instantiates and it acquires the pod’s IP and sets up the network namespace. All the other containers in the pod then join the infra container’s network and IPC namespace. … Read more

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