Coder Social home page Coder Social logo

offline_docker_registry_example's Introduction

Secure Docker Registry

This repository contains the necessary files to build and run a secure Docker registry using basic authentication.

Files

  • Dockerfile: The Dockerfile used to build the Docker image for the secure registry.
  • config.yml: The configuration file for the Docker registry.

Getting Started

Prerequisites

  • Docker installed on your system.

Building the Docker Image

To build the Docker image, run the following command in the directory containing the Dockerfile and config.yml:

docker build -t myregistry:secure .

Running the Docker Container

After building the image, you can run a container from it using the following command:

docker run -d -p 5000:5000 --name my-secure-registry myregistry:secure

This command runs the Docker registry on port 5000.

Logging In

To log in to the secure Docker registry, use the following command:

docker login localhost:5000 -u myuser -p mypassword

Pushing an Image

To push an image to the secure registry, tag it with the registry's address and use the docker push command. For example:

  1. Tag the image:

    docker tag your-image:latest localhost:5000/your-image:latest
  2. Push the image:

    docker push localhost:5000/your-image:latest

Pulling an Image

To pull an image from the secure registry, use the docker pull command:

docker pull localhost:5000/your-image:latest

Testing the Setup

  1. Build the Docker Image:

    docker build -t myregistry:secure .
  2. Run the Docker Container:

    docker run -d -p 5000:5000 --name my-secure-registry myregistry:secure
  3. Log in to the Registry:

    docker login localhost:5000 -u myuser -p mypassword
  4. Tag an Image:

    docker tag hello-world:latest localhost:5000/hello-world:latest
  5. Push the Image:

    docker push localhost:5000/hello-world:latest
  6. Pull the Image:

    docker pull localhost:5000/hello-world:latest

If all steps complete successfully, your secure Docker registry is set up and working correctly.

Configuration

  • REGISTRY_AUTH: The authentication method. Set to htpasswd to use basic authentication.
  • REGISTRY_AUTH_HTPASSWD_REALM: The realm for basic authentication.
  • REGISTRY_AUTH_HTPASSWD_PATH: The path to the htpasswd file.

These environment variables are set in the Dockerfile and used to configure the registry.

License

This project is licensed under the MIT License - see the LICENSE file for details.

offline_docker_registry_example's People

Contributors

talknopf avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.