I am using the below command in the dockerfile to automatically start mysql on docker run:
ENTRYPOINT service mysql start && bash
The above command is working fine in some system but not in all. I also have tried the below command but still facing the same issue.
EXPOSE 3306
CMD /etc/init.d/mysql start && \
/bin/bash
I am getting the below error in some system:
* Starting MySQL database server mysqld [fail]
So can anyone please help me solve this issue. So that my docker container can run on all type of system where docker can be installed.
First, it depends on your exact docker run command.
As commented here, you approach works with docker run -itd ...
Second, it depends on the host, which should be compatible with docker execution (ie, its kernel should be the right architecture, 64bits not 32, recent enough...)
The OP adds:
I am using docker run -it docker_image_name command to run the docker image and second system i.e. Linux corona2 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux its not working.
I have used 1.8.3 version to build my image and.
is it because of the community edition version as ce is written with 18.03.1-ce.
Then yes: make sure to use the same docker version for building and running (on both servers)
Related
I saw similar treads but they are different because I am using WSL2 and docker and GPU aware docker.
I have windows 10 version 2004 (build 20161.1000)
I have installed WSL 2 and have Docker Desktop 2.3.0.3 on my Windows System running.
I have Ubuntu 18.04 LTS installed in WSL 2 too.
I have installed the NVIDIA driver
The linux version is 4.19.121-microsoft-standard.
The NVIDIA driver version is 455.41 for my Laptop GPU QUADRO M2000M.
Actually I followed all the steps described in https://ubuntu.com/blog/getting-started-with-cuda-on-ubuntu-on-wsl-2 until the step where I have to run "sudo service docker stop" in an Ubuntu terminal.
This results in a message docker: unrecognized service.
I have to restart docker desktop in WIndows 10 in order to get the deamon running.
I test then in the Ubuntu terminal : docker run hello-world ==> this runs fine
Also the command docker run -it ubuntu bash ==> runs file in the Ubuntu terminal os WSL 2.
BUT when I run :
docker run -u $(id -u):$(id -g) -it --gpus all -p 8888:8888 tensorflow/tensorflow:latest-gpu-py3-jupyter
then I get the error : docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]]
This invoves microsoft,Ubuntu,NVIDIA. I have search the support sites but could not find anything that solves my prblem.
Can anyone help me here?
There is this strange answer mentioned here and here:
sudo service docker start
sudo mkdir /sys/fs/cgroup/systemd
sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd
This worked for me on WSL (Ubuntu 20.04), so I added it to the ~/.bashrc script.
Note, the first part may need to be restarting docker!
I would like to setup cuda using the following code:
docker run -ti --rm --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 nvidia/cuda
I Kept getting these Errors:
Command 'docker' not found, but can be installed with:
snap install docker # version 18.06.1-ce, or
apt install docker.io # version 18.09.7-0ubuntu1~19.04.5
See 'snap info docker' for additional versions.
I tried to google these Errors, but failed.
System Environment: Ubuntu Desktop 19.04
I should explain that this is a clean System I'm currently using.
I should tell you one thing that, installing anything with docker comes with a prerequisite, which is that you should install docker first.
You can find the tutorials on how you could install docker in the following link:
How to install Docker
And then you could install Nvidia compiled docker container with the following command:
docker pull nvidia/cuda
docker run -ti --rm --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 nvidia/cuda
which was referenced from Nvidia CUDA Docker Hub and Nvidia CUDA GitHub page
I have Jenkins installed locally on my laptop running windows 10. I spin up a Linux container running SQL Server, however when I attempt to run the following:
winpty docker exec -it SQLLinuxnull sudo /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P P#ssword1 -Q 'EXEC sp_configure '\''clr enabled'\'', 1;'
I get:
stdin is not a tty
When I run the docker exec command from a powershell session it completes without any issues. Trawling this site pulls up answer suggesting that this might be something to do with whatever account is being used in the Linux container requiring the ability to execute sudo and that I should alter the /etc/sudoers file, the problem being is that I do not have an /etc/sudoers file, according to uname -a this is the version of Linux the container is based on (not that its base is the official Microsoft SQL server in Linux image):
# uname -a
Linux f9509a952eae 4.9.49-moby #1 SMP Wed Sep 27 00:36:29 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Can someone confirm that this is a sudoers related issue.
docker exec -it
...requires that it be run in a context with a TTY available. If you can avoid needing stdin or a terminal later in the program's execution (for example, having /etc/sudoers inside the container configured with the RequireTTY option disabled), you should be able to simply remove the -it flags.
I want to extend my jenkins image to have docker installed so it can build a Dockerfile out of a project.
I found a nice install script for docker but only for Ubuntu 64bit. What I need to know is if the parent images of my jenkins image base on Ubuntu 64bit so I can use this install script without any problems.
I used docker image inspect <imagename> already but it only yields hashes for former image versions it seems.
docker run <image-name> cat /etc/*release*
It will return the metadata about your image. In the following form.
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
VARIANT_ID="202011171307-al2.470.0"
Amazon Linux release 2 (Karoo)
cpe:2.3:o:amazon:amazon_linux:2
In the docker world you'll encounter OSes like Alpine more or less frequently.
Hence its mostly advisable to get contents of the /etc/os-release file which will in most scenarios be present.
# Tomcat 9 running on Alpine OS
docker run -it tomcat:9-alpine cat /etc/os-release
# Tomcat 9 running Debian (buster)
docker run -it tomcat:9 cat /etc/os-release
The fact that your Jenkins is built on an Ubuntu 64 bits or a Fedora 24 or a Debian jessie should not bother you, as it should work anyway.
See
Run Different Linux OS in Docker Container?
for more explanations
and also
Docker container isolation, does it care about underlying Linux OS?
Anyway, if you want to get the FROM line of the Dockerfile used to build this image,
you can use the docker image
https://hub.docker.com/r/dduvnjak/dockerfile-from-image/
to get the
FROM UBUNTU
or
FROM DEBIAN
example from
How to check for Certain Properties in Docker Images
$ docker run -v /var/run/docker.sock:/var/run/docker.sock dduvnjak/dockerfile-from-image k3ck3c/nethogs | grep FROM
will show
FROM alpine:latest
Following command worked docker run mysql cat /etc/os-release.
Output:
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
. . .
I don't think there is currently any docker command that allows you to do that. It seems that the only way is to launch the container and run those commands: determine OS distribution of a docker image
Solution: docker run mysql cat /etc/os-release
Output:
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
I am trying to upgrade to docker 1.9 from docker 1.8 version
I have used the following command to upgrade docker:
sudo wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O
/usr/bin/docker
Howerver, after successful upgrade I am not able to restart the docker service.
The following command is failing
sudo systemctl start docker
Please help
It seems your disk is full. Check the disks df -h. And prepare enough disk space for your apps