I'm trying to run a script in a docker image and I keep getting the following error
Step 4/4 : RUN ./config.sh /config.sh
---> Running in a0739624bcb7
failed to create shim: OCI runtime create failed: runc create failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown
My docker file is based upon Ubuntu, so I'm unsure why this error even occurs, I found a lot of these issues because people use scratch
FROM ubuntu:20.04
ENV ACCESS_TOKEN ""
COPY ./config.sh /config.sh
RUN /config.sh $ACCESS_TOKEN
I tried so many things, and it just doesn't make sense, I tried docker rmi ubuntu and docker system prune in case this would be a corruption of the image, but to no avail.
With that being said, I'm still able to do the following, so any insight is welcome
docker run -it ubuntu:20.04 /bin/sh
docker run -it ubuntu:20.04 /bin/bash
Also, my script has a shebang for /bin/bash, so why is the issue with /bin/sh
I'm now running into the same problem when using FROM ubuntu:20.04.
Using FROM ubuntu:18.04 or FROM phusion/baseimage:18.04-1.0.0-amd64 both work OK with my dockerfile.
Output when creating the docker image:
Sending build context to Docker daemon 301.5MB
Step 1/3 : FROM ubuntu:20.04
20.04: Pulling from library/ubuntu
eaead16dc43b: Pull complete
Digest: sha256:450e066588f42ebe1551f3b1a535034b6aa46cd936fe7f2c6b0d72997ec61dbd
Status: Downloaded newer image for ubuntu:20.04
---> 680e5dfb52c7
Step 2/3 : COPY . /
---> 8623e2ab9bb0
Step 3/3 : RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y --no-install-recommends libprotobuf17 libjson-c4 libpcap0.8 iproute2 ethtool pciutils inotify-tools python3-pip libnuma1 gdb libgoogle-perftools-dev rsyslog && pip3 install requests && ln -s /usr/bin/python3 /usr/bin/python && apt-get clean && rm -rf /var/lib/apt/lists/* && echo apt-get DONE
---> Running in 3e0fffb2b1fd
failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown
From docker info:
Server Version: 20.10.17
Kernel Version: 5.4.0-131-generic
Operating System: Ubuntu Core 18
Running on a VM with:
Linux ubuntu-dev3 5.4.0-131-generic #147-Ubuntu SMP Fri Oct 14 17:07:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
ixia#ubuntu-dev3:~/git/GSC/next_gen_gsc/GscApp$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.5 LTS
Release: 20.04
Codename: focal
As MathieuAuclair stated, I can also just run the ubuntu:20.04 image by itself and it it is OK.
I can execute /bin/sh and /bin/bash from inside the container.
Related
When I run this image om my Mac with M1 chip, everything is OK.
But when I try to run on server with Ubuntu, container stops with error "exec /bin/sh: exec format error"
FROM mcr.microsoft.com/playwright:v1.18.1-arm64
RUN apt-get -y update && apt-get -y upgrade
ADD build/libs/program.jar /tmp
WORKDIR /tmp
RUN apt-get -y install openjdk-11-jre-headless && apt-get clean;
CMD java -jar program.jar
This error displays on each first command RUN. Even if the command is like "RUN ls -la", I will get "/bin/sh -c ls -la returned a non-zero code: 1".
I tried to change SHELL["bin/bash","-c"] and image version but there was no effect.
If I use "FROM ubuntu", commands work, but I need exactly image for Playwright with browser dependencies.
You are building an image with ARM architecture (check with docker inspect <your_image> | grep "Archi"). This image cannot be executed on another architecture (probably amd64 for your Ubuntu server).
You should:
use an amd64 base image (mcr.microsoft.com/playwright:v1.18.1-arm64 => mcr.microsoft.com/playwright:v1.18.1-focal for example)
build your image with docker build --platform linux/amd64
I'm not a native speaker of English, but I want to ask a question on Stack Overflow.
and I am a beginner at Docker.
I am trying to set up the development environment at Silicon Mac M1 from Intel mac.
#!/bin/sh
set -e
. ./env.list
# Build Docker image
# docker pull store/ibmcorp/db2_developer_c:11.1.4.4-x86_64
docker build -t ${REPOSITORY}:${TAG} .
# DOCKERFILE
FROM store/ibmcorp/db2_developer_c:11.1.4.4-x86_64
RUN yum -y update && yum clean all
RUN curl ftp://ftp.pbone.net/mirror/vault.centos.org/7.8.2003/os/x86_64/Packages/glibc-common-2.17-307.el7.1.x86_64.rpm > /tmp/glibc-common.rpm
RUN rm -f /etc/localtime
RUN mkdir /var/custom
and I got errors like below
Step 2/30 : RUN yum -y update && yum clean all
---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
I already add --platform linux/amd64 another docker run command
#!/bin/bash
. ./env.list
docker rm -f api-db
docker run --name api-db -h db2server --restart=always --detach --privileged=true -p 50000:50000 -p 55000:55000 --platform linux/amd64 --env-file env.list sample-app:v1.0
what should I do for a dockerfile?
Thank you so much for reading.
Have a good day! :)
Apple M1 is arm64v8 instruction set processor, so you can not run amd64 (X86_64) on it without emulation. In general, Docker has the ability to emulate other architectures if the emulation based on bitfmt is set up (and on maxOS with intel CPU it's already set-up), however the emulation for amd64 on M1 is not stable yet. This means that for some period of time you will be restricted to 'arm64' images.
To fetch the proper image for you architecture during the build you need to add the following.
FROM --platform linux/arm64 <image name>
You need to check if there are images for db2 development environment for arm by doing
docker pull --platform linux/arm64 store/ibmcorp/db2_developer_c
I have made a docker container meant with some code for deployment. However, I realised that the structure of the project I'm working with, it's more suitable to deploy a full ISO image, instead of running docker on top of a cloud VM running stock debian, leading to unnecessary layers of virtualization.
I know that dockers are meant to be deployed on kubernetes, but before diving into that route, is there a simple way to convert a deb9 docker image into a full deb9 OS image? Like an opposite of docker import?
You can convert your docker container to an full os image. An Dockerfile debian example would be
FROM debian:stretch
RUN apt-get -y install --no-install-recommends \
linux-image-amd64 \
systemd-sysv
In principal you have to install a kernel and an init system.
Full instructions can be found github
Docker images don't contain a Linux kernel and aren't configured to do things like run a full init system or go out and get their network configuration, so this won't work well.
Put differently: the same mismatch that makes docker import not really work well because the resulting container will have too much stuff and won't be set up for Docker, means you can't export a container or image into a VM and expect it to work in that environment.
But! If you've written a Dockerfile for your image, that's very close to saying "I'm going to start from this base Linux distribution and run this shell script to get an image". Tools like Packer are set up to take a base Linux VM image, run some sort of provisioner, and create a new image. If you have a good Docker setup already, and decide a VM is a better fit, you're probably done a lot of the leg-work already to have an automated build of your VM image.
#info
we can use docker like vm / flatpak / appimge / termux with gui, audio and hardware acceleration :)
how to do it ?
remove old docker
sudo apt-get remove docker docker-engine docker.io containerd runc
===================
install the commponents
sudo apt-get update
sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release
=============================
3.. add docker repo docker
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
================
install docker
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
=============================
=========================
create docker
docker image
su
cd /home/
kwrite Dockerfile
FROM debian:testing
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y install midori bash mpv pulseaudio pulseaudio-utils pulsemixer pulseaudio-module-jack apulse neofetch vlc smplayer wget sudo cairo-dock cairo-dock-plug-ins xfce4 xfce4-goodies falkon kde-full xfce4-whiskermenu-plugin gnome tigervnc-standalone-server openssh-server openssh-client network-manager net-tools iproute2 gerbera openjdk-11-jdk mediainfo dcraw htop gimp krita libreoffice python3-pip terminator uget alsa-utils
ENV PULSE_SERVER=tcp:host.docker.internal:4713
CMD bash
save it
the run interminal
sudo docker build -t supersifobian .
how to use gui
xhost +
run image gui
sudo apt-get -y install xpra xserver-xephyr xinit xauth
xclip x11-xserver-utils x11-utils
run docker
sudo docker run -ti --net=host --device=/dev/dri:/dev/dri -e DISPLAY=:0 --privileged --cap-add=ALL --device /dev/snd --volume /dev:/dev -v /dev:/dev --group-add audio -v /var/run/docker.sock:/host/var/run/doc -e PULSE_SERVER=tcp:$P ULSE_SERVER -v /dev:/host/dev -v /proc:/host/proc:ro -v /boot:/host/boot:ro -v /lib/modules:/host/lib/modules:ro -v /usr:/host/usr:ro -v /media:/host/media:ro -v /home:/host/home:ro imageid / image name
nb
enter container
docker exec -it nama/id container bash
add user
adduser namauser
make use as sudo
usermod -aG sudo username
add group audio
usermod -aG audio username
=========================
audio in docker cli
using prafer
a. install paprefs
apt-get install paprefs
b.choose network in prafers
c. how to know the pulse audio port, we can type
pax11publish
d. export to terminal in docker
export "PULSE_SERVER=tcp:192.168.43.135:37721"
==================================
save docker
docker commit idcontainer nameimage:version
========================
check images
docker images
==================================
thanks :)
I'm trying to build a docker image containing the oracledb client and nodejs, but I'm getting the error The command '/bin/sh -c ldconfig' returned a non-zero code: 1 on RUN ldconfig.
I cannot find anything to help me solve this problem and I've been trying to solve this myself for the last 2hours, and I need help!
Additional info:
Oddly, when I go into the container with docker exec -it container_name sh and then execute ldconfig, it runs fine...
This is the dockerfile:
FROM node:9.11-alpine
WORKDIR /
COPY ./oracle /opt/oracle
RUN apk update && \
apk add --no-cache libaio && \
mkdir /etc/ld.so.conf.d && \
sh -c "echo /opt/oracle/instantclient_12_2 > /etc/ld.so.conf.d/oracle-instantclient.conf" && \
ldconfig
ENV LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH
ENV PATH=/opt/oracle/instantclient_12_2:$PATH
CMD ["tail", "-f", "/dev/null"]
In alpine ldconfig requires the configuration directory as an argument.
Try running ldconfig like this:
ldconfig /etc/ld.so.conf.d
Theoretically that should work.
See my blog post series Docker for Oracle Database Applications in Node.js and Python that shows using Instant Client in Oracle Linux containers.
Also see the node-oracledb installation manual section Using node-oracledb in Docker.
The latest sample Oracle Instant Client container Dockerfile automatically pulls the required RPMs - no manual download required. Oracle Instant Client 19 will connect to Oracle DB 11.2 or later.
I'm trying to update docker/boot2docker using boot2docker download command but upon starting it, it is still running 1.3.2 client (docker --version)
bash-3.2$ boot2docker download
Latest release for boot2docker/boot2docker is v1.4.0
Downloading boot2docker ISO image...
Success: downloaded https://github.com/boot2docker/boot2docker/releases/download/v1.4.0/boot2docker.iso
Also, from the docker github OS X installer page, 1.3.2 is the only download option.
Thanks!
You can manually download latest Docker binary and replace the existing one. Instruction here.
This is my shell script to install+update latest Docker on a CentOS6/RHEL:
#!/bin/bash
# YUM install docker with required dependencies
yum -y install docker-io
# Move to a temp working directory
work_dir=$(mktemp -d)
cd "${work_dir}"
trap "rm -rf -- ${work_dir}" EXIT
# WGET latest release of Docker
wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O docker
chmod +x docker
# Replaces Docker with latest Docker binary
mv docker /usr/bin/docker
# Start Docker service
service docker start
Depend on where your binaries are stored, it might be a different location than /usr/bin