- Build the image from the Dockerfile above:
docker build --rm -t cberg-test .
- Run a container, sharing the host dir
/root/foo
:
docker run --rm -v /root/foo:/foo cberg-test
- In another shell, write something to the socket (which was created in
/root/foo
by the container):
echo 'hello docker' | socat - UNIX-CONNECT:/root/foo/bar.sock
- See the output of the container in the first shell:
hello docker
docker run --name mysql-server -t
-v /var/run/mysqld:/var/run/mysqld
-d mysql:5.7
--socket=/var/run/mysqld/mysqld.sock
It does not work well ,when i ru the command
docker logs mysql-server
,then found this:[ERROR] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.