예제 #1
0
        public void Inspects()
        {
            var containerName = "lcldkr-inspect-test";
            var client        = new DockerClient();

            try
            {
                client.RunOrReplace(
                    "ubuntu",
                    tag: null,
                    args: new RunArguments()
                {
                    Name = containerName
                },
                    command: "tail -f /dev/null"); //we want the container to stay running

                var ipString = client.Inspect(containerName, "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}");

                IPAddress ip;
                bool      isIp = IPAddress.TryParse(ipString, out ip);

                Assert.True(isIp);
            }
            finally
            {
                client.StopAndRemoveContainer(containerName);
            }
        }