Below you will find pages that utilize the taxonomy term “docker”
Posts
Start Postgres container and connect with JDBC
Quick example of how to set up a Docker container with Postgresql, using the Spotify Docker Java client.
This supposes a running Docker installation on your local computer, for example using boot2docker.
import com.google.common.base.Strings; import com.google.common.net.HostAndPort; import com.spotify.docker.client.DefaultDockerClient; import com.spotify.docker.client.DockerCertificateException; import com.spotify.docker.client.DockerClient; import com.spotify.docker.client.DockerException; import com.spotify.docker.client.messages.ContainerConfig; import com.spotify.docker.client.messages.ContainerCreation; import com.spotify.docker.client.messages.ContainerInfo; import com.spotify.docker.client.messages.HostConfig; import lombok.extern.slf4j.Slf4j; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; @Slf4j public abstract class PostgresContainerExample { public static Connection setUpDbContainer() throws SQLException { try { // This will only work with the DOCKER_HOST environment variable set final DockerClient docker = DefaultDockerClient.
Posts
Start Postgres container and connect with JDBC
Quick example of how to set up a Docker container with Postgresql, using the Spotify Docker Java client.
This supposes a running Docker installation on your local computer, for example using boot2docker.
import com.google.common.base.Strings; import com.google.common.net.HostAndPort; import com.spotify.docker.client.DefaultDockerClient; import com.spotify.docker.client.DockerCertificateException; import com.spotify.docker.client.DockerClient; import com.spotify.docker.client.DockerException; import com.spotify.docker.client.messages.ContainerConfig; import com.spotify.docker.client.messages.ContainerCreation; import com.spotify.docker.client.messages.ContainerInfo; import com.spotify.docker.client.messages.HostConfig; import lombok.extern.slf4j.Slf4j; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; @Slf4j public abstract class PostgresContainerExample { public static Connection setUpDbContainer() throws SQLException { try { // This will only work with the DOCKER_HOST environment variable set final DockerClient docker = DefaultDockerClient.
Posts
Docker Swarm setup
Edit 2015-01-07: Updated article to reflect changes in swarm. Thanks Rael!
Docker Swarm was announced at the first European DockerCon. Swarm is a pluggable cluster manager with a simple scheduler.
It’s currently not super easy to set up, so here is how I did it.
Background The swarm executable discovers hosts by reading entries from the discovery url, discovery-stage.hub.docker.com/v1/clusters/TOKEN. Sample output:
["128.199.36.196:2375","128.199.50.146:2375","128.199.32.159:2375"] As you can see, this is just a list of IP/port combinations.
Posts
Service discovering Docker cluster on Digital Ocean
Jeff Lindsay wrote about “Consul Service Discovery with Docker” and Automatic Docker Service Announcement with Registrator. Using Docker’s event stream is an elegant solution to finding out which containers are running on a particular host. Despite Jeff’s documentation and videos, I couldn’t get Consul to serve up the correct locations of my services.
Here is a description of what I did to get a service discovering cluster to run on Digital Ocean.