docker error when using --log-driver="syslog" on OS X
I am trying to learn how to use docker containers on OS X (10.10.3), I understand the differences with the standard Linux implementation ( need boot2docker VM) and I wonder if there is any impact on the way I can log messages with syslog
when I start a container with the --log-driver="syslog" option, the container is created but I get an error upon start
~$ docker run --log-driver="syslog" --name daemon_dwayne -d ubuntu /bin/sh -c "while true; do echo hello_world; sleep 2; done;"
1f623793049916d5c....
FATA[0000] Error response from daemon: Cannot start container 1f623793049916d5....: Unix syslog delivery error
this is running fine on a Linux machine... thanks for any hint
Boot2docker runs in a small linux VM. By default, syslog isn't running in the VM. You can turn it on by running syslogd in the VM e.g:
$ boot2docker ssh
...
docker#boot2docker:~$ syslogd
If you then try running your container again it should work.
You can make this change permanent by calling syslogd from the file /var/lib/boot2docker/bootsync.sh inside the boot2docker VM, which boot2docker will execute before starting Docker.
Related
I am using a centos 7.9 for my docker. I'm running a C++ program in my docker image which writes logging via syslog.
However, I cannot find these log anywhere when I run it in docker. On my centos machine, the logging would by default go to /var/log/messages, but on docker /var/log/messages is empty. I've tried setting the docker logging driver to syslog (in the docker run command) and I can see rsyslogd running in the docker container as well with ps -aux.
On my host machine, /var/log/syslog does not receive the logs either.
How do I get the log files to write to the /var/log/messages on the docker environment (or to my host machine, if storing them on the docker environment is not advisable)?
Thanks.
Since docker does not support systemd, it's very likelly that syslog is not running on your container
My suggestion is... start a shell at your container
make sure syslog is installed using
yum list --installed
or
rpm -qa
Them run the syslog daemon from the shell manually
after that, start a new terminal and run your code
ps: since I'm on my phone, i can't be more helpful
I'll try to edit it as soon as possible
I downloaded minikube after that ...
I did minikube start... so, node started
I played around with some containers(deployment object)
Now when I am doing docker ps => it's showing all the k8's container running -_-"
What I wanted to see is the local Docker Daemon containers rather than Vm's containers
When I run minikube docker-env it shows:
Exiting due to ENV_DRIVER_CONFLICT: 'none' driver does not support 'minikube docker-env' command
What should I do now to connect to local Docker Daemon ?
I am using Ubuntu 18 :)
Since you started minikube without specifying driver, the host docker daemon will be used, so you can access it without any special environment variables. That’s why you see “ Exiting due to ENV_DRIVER_CONFLICT: 'none' driver does not support 'minikube docker-env' command”
Try starting minikube using other driver viz minikube start --driver=hyperkit
or stopping minkikube
I created a docker image, where Virtualbox is running inside of a Docker Container (Base Image is a modified Ubuntu-20.04)
I fixed everything regarding creating the image and now my Virtual Machines are running inside the Container. Now I am trying to access these via RDP from the Host (also Ubuntu 20.04), via rdesktop.
The command running the Image is:
docker run -d --privileged --name vbox --device /dev/vboxdrv:/dev/vboxdrv -v /sys/fs/cgroup:/sys/fs/cgroup:ro -v /tmp:/tmp -v ~/machines:/machines -p 3389:3389 -it vboxsystemd
The VM started headless with vboxmanage startvm nameofvm --type headless, vrde is on and the port is 3389
I got the IP of the container by docker inspect vbox, then i tried connecting it by typing rdesktop ip:3389
It just says it cannot connect, and I have no idea how I could fix this.
Currently I am only running 1 VM, which I imported from the local Virtualbox, where it is working without any problems. It is also starting without problems inside the container.
Thanks in advance for helping me.
I am new in using docker and I am trying to implement SWARM according to this tutorial -
https://docs.docker.com/get-started/part4/#create-a-cluster
The tutorial starts with -
Launch Hyper-V Manager
Click Virtual Switch Manager in the right-hand menu
Click Create Virtual Switch of type External
I am using Windows 10 PRO and I cannot use Hyper-V Manager and Docker terminal at the same time. Because if I activate Hyper-V and then start docker terminal, my PC shows an error and shut down automatically.
So, I tried to create a virtual machine without Hyper-V by following code
$ docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" myvm1
and as expected I got this error -
Wrapper Docker Machine process exiting due to closed plugin server (connection is shut down)
Error with pre-create check: "read tcp 127.0.0.1:50588->127.0.0.1:50587: wsarecv: `An existing connection was forcibly closed by the remote host."`
So, is there any alternative solution how can I proceed or to use Hyper-V Manager in Windows 10 without such problem.
Thanks a lot for your time :)
Virtualbox and Hyperv don't work together. Since you are using docker quickstart terminal you should be using VirtualBox for the VM
$ docker-machine create -d virtualbox swarmanager1
$ docker-machine create -d virtualbox nodes1
$ docker-machine create -d virtualbox nodes2
Once done you switch to manager node
$ eval $(docker-machine env swarmanager1)
$ docker swarm init --advertise-addr eth0
This will give you a token command and you need to execute them for each node
$ eval $(docker-machine env nodes1)
$ docker <swarm command from manager>
I've noticed that boot2docker runs docker on a VM as a deamon on port 2375.
Then I use local Mac OS X 'docker' command and it executes all calls on VM.
These are the commands I use:
boot2docker start
export DOCKER_HOST=tcp://:2375
And then 'docker images' (for example) is running on VM.
How can I do the same with a physical machine rather then VM?
boot2docker is meant to be for dev purpose. It will spawn a VM. For bare metal, simply install docker on the host and start the docker daemon with docker -d -H tcp://0.0.0.0:4243.
WARNING: This is very dangerous. Anyone will have root access to your host. In order to secure this, you should change 0.0.0.0 to 127.0.0.1 and either use a SSH tunnel or a nginx/apache frontend with authentification.
On you mac, then just export DOCKER_HOST=tcp://<host ip>:4243