DEV Community

Zahir Din
Zahir Din

Posted on

1

Docker Error: /lib64/ld-linux-x86-64.so.2: No such file or directory

When working with docker, sometimes we encounter an error we didn't expect. Sometimes it work on other machine but not yours. Docker help developer to run an application or system with same environment. It help reduce the "it work on my machine" stuff.

Unfortunately, it also depends on host machine we use. For example Windows OS using WSL to run docker, or MacBook M1 chip to run docker.

Some people might have encountered an error like this before:

qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
Enter fullscreen mode Exit fullscreen mode

The error message encountered indicates that the /lib64/ld-linux-x86-64.so.2 file is missing inside the Docker container. This file is required for running x86_64 binaries on an x86_64 system.

To resolve this issue, you can try adding the libc6 package to the Docker image.

# Use the latest Ubuntu image as the base
FROM ubuntu:latest

# Install necessary dependencies
RUN apt-get update && apt-get install -y libc6

# Do something here...
Enter fullscreen mode Exit fullscreen mode

If you don't want to install any package inside a container, other approach is to run it as other platform. We can use it like this:

docker build --platform=linux/amd64 -t my_name/my_image .
Enter fullscreen mode Exit fullscreen mode

There is also other solution and that was to add --platform=linux/amd64 to the FROM line of the docker file.

FROM --platform=linux/amd64 ubuntu:latest
Enter fullscreen mode Exit fullscreen mode

Thanks to the resource I've found here.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay