public void RunPostgresContainerAndCheckThatAllProcessesAreRunning()
        {
            string id = null;

            try
            {
                var cmd = _docker.Run("kiasaki/alpine-postgres", new ContainerCreateParams
                {
                    PortMappings = new[] { "40001:5432" },
                    Environment  = new[] { "POSTGRES_PASSWORD=mysecretpassword" }
                }, _certificates);

                Assert.IsTrue(cmd.Success);

                id = cmd.Data;
                Assert.IsTrue(!string.IsNullOrWhiteSpace(id));
                Assert.AreEqual(64, id.Length);

                var config = _docker.InspectContainer(id, _certificates);
                Assert.IsTrue(config.Success);
                Assert.AreEqual(true, config.Data.State.Running);

                var endpoint = config.Data.NetworkSettings.Ports.ToHostPort("5432/tcp", _docker);
                endpoint.WaitForPort(10000 /*10s*/);

                var ls = _docker.Top(id, _certificates);
                Assert.IsTrue(ls.Success);

                var proc = ls.Data;
                Debug.WriteLine(proc.ToString());

                Assert.AreEqual(6, ls.Data.Rows.Count);
                Assert.IsTrue(proc.Rows.Any(x => x.Command == "postgres"));
                Assert.IsTrue(proc.Rows.Any(x => x.Command == "postgres: checkpointer process"));
                Assert.IsTrue(proc.Rows.Any(x => x.Command == "postgres: writer process"));
                Assert.IsTrue(proc.Rows.Any(x => x.Command == "postgres: wal writer process"));
                Assert.IsTrue(proc.Rows.Any(x => x.Command == "postgres: autovacuum launcher process"));
                Assert.IsTrue(proc.Rows.Any(x => x.Command == "postgres: stats collector process"));
            }
            finally
            {
                if (null != id)
                {
                    _docker.RemoveContainer(id, true, true, null, _certificates);
                }
            }
        }
        public void RunPostgresContainerAndCheckThatAllProcessesAreRunning()
        {
            string id = null;

            try
            {
                var cmd = _docker.Run("postgres:9.6-alpine", new ContainerCreateParams
                {
                    PortMappings = new[] { "40001:5432" },
                    Environment  = new[] { "POSTGRES_PASSWORD=mysecretpassword" }
                }, _certificates);

                Assert.IsTrue(cmd.Success);

                id = cmd.Data;
                Assert.IsTrue(!string.IsNullOrWhiteSpace(id));
                Assert.AreEqual(64, id.Length);

                var config = _docker.InspectContainer(id, _certificates);
                Assert.IsTrue(config.Success);
                Assert.AreEqual(true, config.Data.State.Running);

                var endpoint = config.Data.NetworkSettings.Ports.ToHostPort("5432/tcp", _docker);
                endpoint.WaitForPort(10000 /*10s*/);

                var ls = _docker.Top(id, _certificates);
                Assert.IsTrue(ls.Success);

                var proc = ls.Data;
                Debug.WriteLine(proc.ToString());

                Assert.AreEqual(2, ls.Data.Rows.Count);
                Assert.IsTrue(proc.Rows.Any(x => x.Command == "bash /usr/local/bin/docker-entrypoint.sh postgres"));
                Assert.IsTrue(proc.Rows.Any(x => x.Command == "pg_ctl -D /var/lib/postgresql/data -m fast -w stop"));
            }
            finally
            {
                if (null != id)
                {
                    _docker.RemoveContainer(id, true, true, null, _certificates);
                }
            }
        }