Docker: Difference between revisions
→Docker Containers as systemd Services: make clearer oci-containers uses podman by default but can also use docker |
→Usage: expose mariadb via socket |
||
Line 119: | Line 119: | ||
# podman exec -ti $ContainerId /bin/sh | # podman exec -ti $ContainerId /bin/sh | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===== Exposing ports from the host ===== | |||
If you have a service running on the host that you want to connect to from the container, you could try connecting to the hostname <code>host.containers.internal</code> (or <code>host.docker.internal</code> for podman), but this might require additional networking setup | |||
===== Exposing sockets from the host ===== | |||
If you have a service running on the host that exposes a socket, such as mariadb, you can also expose that socket to the container instead. You'll want to expose the folder the socket is in as a volume - so: | |||
<syntaxHighlight lang=bash> | |||
volumes = [ | |||
"/var/run/mysqld:/mysqld" | |||
]; | |||
</syntaxHighlight> | |||
to provide access to <code>/var/run/mysqld/mysqld.sock</code> | |||
=== Running the docker daemon from nix-the-package-manager - not NixOS === | === Running the docker daemon from nix-the-package-manager - not NixOS === |