I use docker on centOS, and test docker on MAC OS X. But I want to see the log information when docker run. How to find the log?
The daemon on Boot2docker or CentOS should have its log in /var/log/docker.log.
For boot2docker, you need to be in a boot2docker session.
(this isn't always the case: On Ubuntu, for instance, this would be different: /var/log/upstart/docker.log).
If you need to see more log, you can start the daemon with the -D option.
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'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 used docker with docker-machine ( can access container server by 192.168.99.100 ). I would like not to use docker-machine. so I can directly access my container by localhost (127.0.0.1). I shut down docker-machine (docker-machine stop) and tried to build image and container, but It said 'no daemon'. how should I completely shut down docker-machine and use local docker?
I think what you want is unset all docker-machine environment variables to use you host Docker daemon. This can be achieved with this command.
eval $(docker-machine env -u)
There are two different installs for docker on Mac. Both use a VM running Linux under the covers.
The older method includes docker toolbox and docker machine to manage the VM in virtualbox. When you use docker machine to stop this VM, the docker commands have no host to run on and will error out as you've seen.
The newer install uses xhyve to run the VM and various other tricks to make it appear seamless. This is a completely different install that you download and run from Docker, and it requires your Mac be at least version 10.10.3 with Yosemite.
See this install page for more details: https://store.docker.com/editions/community/docker-ce-desktop-mac?tab=description
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)