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
Related
I am running a new container using the following command:
docker run -d --log-driver=gelf --log-opt gelf-address=tcp://<my_log_server> nginx
Looking at the documentation, this should send the logs to my_log_server, and if I run the docker logs <my_container> command I shoult NOT see any logs.
But actually I do, and I don't want this.
Do you have any idea why this is happening?
I'm testing it with Docker version 20.10.8, build 3967b7d
According to the docker documentation - https://docs.docker.com/config/containers/logging/configure/
When using Docker Engine 19.03 or older, the docker logs command is only functional for the local, json-file and journald logging drivers. Docker 20.10 and up introduces “dual logging”, which uses a local buffer that allows you to use the docker logs command for any logging driver. Refer to reading logs when using remote logging drivers for details.
Hope it clarifies.
I've installed the docker toolbox on my machine. Once I try to pull down some images from a repository with docker pull, several of them "timeout". The docker documentation recommends that I configure the docker daemon to configure the number of concurrent download sessions:
dockerd --max-concurrent-downloads 1
However, when I execute the above command, I get the following error:
Error starting daemon: This version of Windows does not support the docker daemon
If I run docker.exe daemon I get the following error:
`docker daemon` is not supported on Windows. Please run `dockerd` directly
Is there a different way I can limit the number of concurrent downloads with the docker toolbox?
Docker toolbox nests the docker daemon (dockerd) inside a virtual machine that you can modify using docker-machine ssh.
The typical installation of Docker toolbox uses the Oracle Virtualbox driver, which uses by default the boot2docker image.
According to the documentation of boot2docker, you can add extra arguments for the docker deamon (ie. dockerd) by modifying the /var/lib/boot2docker/profile file:
Docker daemon options
If you need to customize the options used to
start the Docker daemon, you can do so by adding entries to the
/var/lib/boot2docker/profile file on the persistent partition inside
the Boot2Docker virtual machine. Then restart the daemon.
If you are using this configuration (virtualbox + boot2docker), then the following command line might help you. Execute it in your Window shell, it will add the dockerd argument --max-concurrent-downloads with the value 1 for you, in the machine called "default":
docker-machine ssh default "echo \"EXTRA_ARGS=\\\"\$EXTRA_ARGS --max-concurrent-downloads 1\\\"\" | sudo tee -a /var/lib/boot2docker/profile"
Do not forget to restart your machine with docker-machine restart default.
By doing so I was able to add any dockerd argument (mind the version of dockerd used by boot2docker though).
I am running docker commands in the docker quick start terminal. I need to run those commands in my windows terminal. When I check the version of docker, It shows correctly but when I run docker ps or other docker commands. It shows like :
C:\Users\rajasekar.sambandam>docker ps
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.29/containers
/json: open //./pipe/docker_engine: The system cannot find the file specified.
In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
On Windows, docker runs in the background in an linux VM. The quick start terminal delegates all the calls to the VM, and thats why the docker commands work.
When running from a normal terminal, run the command:
eval $(docker-machine env default)
This command will connect the current terminal to the backgound machine.
I just recently started using Docker. I'm able to run my servers, and communicate between them.
What I don't understand is: why do I need to run Docker commands, like $ docker run somerepo/image from the window opened by Docker Quickstart Terminal.
Running it from "regular" Terminal windows returns
$ docker run dockerinaction/hello_world
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?. See 'docker run --help'.
I understand that on OS X and Windows, Docker needs to start one virtual machine with Linux 2.6 (in my case), and that all containers are run within that VM.
I thought docker CLI was connecting to a docker deamon that runs inside that VM - and then I don't understand what happens in the Quickstart Terminal.
I don't understand what does happen in the Quickstart Terminal.
You can use a regular terminal, provided by docker-machine env, and do operations similar to osx/mpkg/quickstart.app/Contents/Resources/Scripts/start.sh:
dockerm-machine start dev
eval "$(docker-machine env dev)"
(replace 'dev' with the name of your docker machine. By default, it is named... "default")
Once those environment variables for the Docker client are set, you can execute docker command directly from your shell.
A Quickstart Terminal would set those same variable for you.
You can see what it does by watching the terminal output. In my case it ran bash --login '/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/start.sh' attempting to start the virtual machine. Once it's running it uses the equivalent of eval "$(docker-machine env default)" to set some environment variables so your terminal is ready to access the Docker VM.
If you need more information have a look at that script start.sh.
What does docker quickstart terminal do?
From Docker docs:
It will create and start a VirtualBox VM running Docker Engine, then
configure the command-line environment so that you can talk to it
In other words it sets some environment variables so your terminal is ready to access the Docker VM. - (thanks to #Nauraushaun)
I´ve installed CoreOs on BareMetal (dedicated 16GB, 4cores Atom). Docker is running and despite the fact that simple bash instructions run properly, when launching dockerui images downloaded form the hub I get the /var/run/docker.sock not found.
The sock file is present and docker daemon is running. When launching docker daemon in interactive shell I get no error from the daemon; but the error is coming from the client requesting running the image.
I bet the container you downloaded expects the docker socket to be mounted in as a volume, so that I can control it or issue docker commands.
Check that the docs you are following don't have docker run -v flag in them.