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
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 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 for a Ruby project. The problem is the project has some gem dependencies that need to build native extensions. My understanding is that I have a couple of choices:
Start with a base image that already has build tools installed.
Use a base image with no build tools, install build tools as a step in the Dockerfile before running bundle install.
Precompile the native extensions on the host, vendorize the gem, and simply copy the resulting bundle into the image.
1 & 2 seem to require that the resulting image contains the build tools needed to build the native extensions. I'm trying to avoid that scenario for security reasons. 3 is cumbersome, but doable, and would accomplish what I want.
Are there any options I'm missing or am I misunderstanding something?
I use option 3 all the time, the goal being to end up with an image which has only what I need to run (not to compile)
For example, here I build and install Apache first, before using the resulting image as a base image for my (patched and recompiled) Apache setup.
Build:
if [ "$(docker images -q apache.deb 2> /dev/null)" = "" ]; then
docker build -t apache.deb -f Dockerfile.build . || exit 1
fi
The Dockerfile.build declares a volume which contains the resulting Apache recompiled (in a deb file)
RUN checkinstall --pkgname=apache2-4 --pkgversion="2.4.10" --backup=no --deldoc=yes --fstrans=no --default
RUN mkdir $HOME/deb && mv *.deb $HOME/deb
VOLUME /root/deb
Installation:
if [ "$(docker images -q apache.inst 2> /dev/null)" = "" ]; then
docker inspect apache.deb.cont > /dev/null 2>&1 || docker run -d -t --name=apache.deb.cont apache.deb
docker inspect apache.inst.cont > /dev/null 2>&1 || docker run -u root -it --name=apache.inst.cont --volumes-from apache.deb.cont --entrypoint "/bin/sh" openldap -c "dpkg -i /root/deb/apache2-4_2.4.10-1_amd64.deb"
docker commit apache.inst.cont apache.inst
docker rm apache.deb.cont apache.inst.cont
fi
Here I install the deb using another image (in my case 'openldap') as a base image:
docker run -u root -it --name=apache.inst.cont --volumes-from apache.deb.cont --entrypoint "/bin/sh" openldap -c "dpkg -i /root/deb/apache2-4_2.4.10-1_amd64.deb"
docker commit apache.inst.cont apache.inst
Finally I have a regular Dockerfile starting from the image I just committed.
FROM apache.inst:latest
psmith points out in the comments to Building Minimal Docker Image for Rails App from Jari Kolehmainen.
For a ruby application, you can remove the part needed for the build easily with:
bundle install --without development test && \
apk del build-dependencies
Since ruby is needed to run the application anyway, that works great in this case.
I my case, I still need a separate image for building, as gcc is not needed to run Apache (and it is quite large, comes with multiple dependencies, some of them needed by Apache at runtime, some not...)
My docker image is tianon/gentoo-stage3:latest
And my host system is centos7 and my docker version is Docker version 1.6.0, build 4749651
When I run this image , I found I can not use rc-update command. ls -l /sbin/rc* show empty result.
I have no idea what package I need to install.
rc-update is provided by the sys-apps/openrc package. Why you don't have it is a mystery without knowing more about the image / setup. The image may be using systemd, but that doesn't necessarily rule out the openrc package being installed.
You should run: ps -p 1 -o command. That will give you an indication of your init system. If it says systemd, whatever you are trying to do with rc-update should probably be done with the systemctl command instead.
If you are indeed using sysvinit / openrc, I suggest you update your openrc package by emerge -a openrc That will restore the rc-update command.
Is it possible to use the ADD and COPY commands in a Dockerfile on Mac OS X using boot2docker? If so, how? The naive just gives No such file or directory.
So, I've tried two things:
having the file in my local directory (same directory as the Dockerfile) on my Mac.
scping the file into a specific path on the boot2docker-vm and using ADD from that path.
Neither work.
Edit:
Plain vanilla Boot2Docker Mac OS X version 1.2 clean install.
Dockerfile:
FROM centos
ADD ./some.rpm /tmp/some.rpm
RUN rpm -Uvh /tmp/some.rpm
I've tried having some.rpm in the same directory as the Dockerfile, I've tried having it in /home/docker in the boot2docker-vm image, I've tried changing ./some.rpm to /home/docker/some.rpm, etc.
For using "ADD" in a dockerfile you need two things:
First: a directory with your structure
for example:
./my_docker_dir/some.rpm
Second: a valid Dockerfile in my_docker_dir (it has to be named 'Dockerfile')
Your line: 'ADD ./some.rpm /tmp/some.rpm' will work
With that prepared you can build your container with 'docker build -t whatever/youwant .'
For more Information read https://docker.readthedocs.org/en/v0.6.3/commandline/command/build/
I believe you should omit the ./, so if some.rpm is in the same folder as your Dockerfile, try
ADD some.rpm /tmp/some.rpm
If the file is in a sub-folder called files next to your Dockerfile, you can do
ADD files/some.rpm /tmp/some.rpm
I made a simple test case for which it works.
Here is the version info for my setup:
$ boot2docker version
Boot2Docker-cli version: v1.4.1
Git commit: 43241cb
$ docker version
Client version: 1.4.1
Client API version: 1.16
Go version (client): go1.4
Git commit (client): 5bc2ff8
OS/Arch (client): darwin/amd64
Server version: 1.4.1
Server API version: 1.16
Go version (server): go1.3.3
Git commit (server): 5bc2ff8
Here is the test case that you can copy-pasta into your terminal:
date > foo.txt
cat > Dockerfile <<EOF
from centos
ADD foo.txt /datefile.txt
EOF
docker build -t addtest .
docker run -i -t addtest /bin/cat /datefile.txt
It even works if you use the /tmp directory, though I suggest against it since that is supposed to be wiped out on every boot.