Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pull latest container from private repo #84

Closed
ta32 opened this issue Apr 30, 2019 · 2 comments
Closed

pull latest container from private repo #84

ta32 opened this issue Apr 30, 2019 · 2 comments
Assignees

Comments

@ta32
Copy link

ta32 commented Apr 30, 2019

Hi is there an option to pull the latest container?
the image repo/docker/db/db_postgres:latest has already been pulled and it is available locally. But it got updated in the private repository by someone else. I want to check for updates and pull the latest version.

            ContainerService = new Builder().UseContainer()
              .UseImage("repo/docker/db/db_postgres:latest")
              .WithCredential( "repo", "Admin", "Password" )
              .ExposePort(PostgresPort, 5432)
              .Build()
              .Start();

            ContainerService.WaitForProcess("postgres", 30000);

Thanks

@mariotoffia
Copy link
Owner

mariotoffia commented Apr 30, 2019

Sorry not, via the Fluent API, at the moment. Instead you have to use a command like this

      var docker = Fd.Native();
     // Contact the docker registry and check if newer, if so -> download
      docker.Host.Login("<server>", "<user>", "<password>", docker.Certificates);
      docker.Host.Pull("repo/docker/db/db_postgres:latest", docker.Certificates);
      
      using (
        var container =
          Fd.UseContainer()
            .UseImage("repo/docker/db/db_postgres:latest")
            .ExposePort(5432)
            .WithEnvironment("POSTGRES_PASSWORD=mysecretpassword")
            .WaitForProcess("postgres", 30000 /*30s*/)
            .Build()
            .Start())
      {
        var config = container.GetConfiguration(true);
        AreEqual(ServiceRunningState.Running, config.State.ToServiceState());
      }

     docker.Host.Logout(docker.Certificates);

I will add this to the Fluent API along the lines of

      using (
        var container =
          Fd.UseContainer()
            .UseImage("postgres:latest", force: true) // default will be false
            .ExposePort(5432)
            .WithEnvironment("POSTGRES_PASSWORD=mysecretpassword")
            .WaitForProcess("postgres", 30000 /*30s*/)
            .Build()
            .Start())
      {
        var config = container.GetConfiguration(true);
        AreEqual(ServiceRunningState.Running, config.State.ToServiceState());
      }

mariotoffia pushed a commit that referenced this issue May 3, 2019
This allows a force pull from either private or public repo and solves Issue #84.
@mariotoffia
Copy link
Owner

mariotoffia commented May 3, 2019

@ta32 I've pushed a fix to allow for force: true on UseImage(...). I hope it works ok for you. If not please do not hesitate to open this issue again!

Cheers,
Mario

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants