docker registry 搭建过程

来源:互联网 发布:ubuntu安装emacs25 编辑:程序博客网 时间:2024/06/06 03:47

参考官网

环境

[root@centos01 ~]# uname -aLinux centos01 3.10.0-514.21.1.el7.x86_64 #1 SMP Thu May 25 17:04:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

docker 安装

yum install docker

验证docker 安装是否成功

[root@centos01 ~]# dockerUsage: docker [OPTIONS] COMMAND [arg...]       docker [ --help | -v | --version ]A self-sufficient runtime for containers.Options:  --config=~/.docker              Location of client config files  -D, --debug                     Enable debug mode  -H, --host=[]                   Daemon socket(s) to connect to  -h, --help                      Print usage  -l, --log-level=info            Set the logging level  --tls                           Use TLS; implied by --tlsverify  --tlscacert=~/.docker/ca.pem    Trust certs signed only by this CA  --tlscert=~/.docker/cert.pem    Path to TLS certificate file  --tlskey=~/.docker/key.pem      Path to TLS key file  --tlsverify                     Use TLS and verify the remote  -v, --version                   Print version information and quitCommands:    attach    Attach to a running container    build     Build an image from a Dockerfile    commit    Create a new image from a container's changes    cp        Copy files/folders between a container and the local filesystem    create    Create a new container    diff      Inspect changes on a container's filesystem    events    Get real time events from the server    exec      Run a command in a running container    export    Export a container's filesystem as a tar archive    history   Show the history of an image    images    List images    import    Import the contents from a tarball to create a filesystem image    info      Display system-wide information    inspect   Return low-level information on a container, image or task    kill      Kill one or more running containers    load      Load an image from a tar archive or STDIN    login     Log in to a Docker registry.    logout    Log out from a Docker registry.    logs      Fetch the logs of a container    network   Manage Docker networks    node      Manage Docker Swarm nodes    pause     Pause all processes within one or more containers    port      List port mappings or a specific mapping for the container    ps        List containers    pull      Pull an image or a repository from a registry    push      Push an image or a repository to a registry    rename    Rename a container    restart   Restart a container    rm        Remove one or more containers    rmi       Remove one or more images    run       Run a command in a new container    save      Save one or more images to a tar archive (streamed to STDOUT by default)    search    Search the Docker Hub for images    service   Manage Docker services    start     Start one or more stopped containers    stats     Display a live stream of container(s) resource usage statistics    stop      Stop one or more running containers    swarm     Manage Docker Swarm    tag       Tag an image into a repository    top       Display the running processes of a container    unpause   Unpause all processes within one or more containers    update    Update configuration of one or more containers    version   Show the Docker version information    volume    Manage Docker volumes    wait      Block until a container stops, then print its exit codeRun 'docker COMMAND --help' for more information on a command.

启动docker

systemctl enable docker.server //开启启动systemctl start docker//启动dockersystemctl status docker//查看docker状态

安装docker registry

root@centos01 ~]# docker run -d -p 5000:5000 --name registry registry:2afb8cc689d0dc24a4107a47985752851687ea0253eae6b55d03f38baef09314b[root@centos01 ~]# sudo docker psCONTAINER ID        IMAGE                             COMMAND                  CREATED             STATUS              PORTS                                                                NAMESafb8cc689d0d        registry:2                        "/entrypoint.sh /etc/"   4 seconds ago       Up 3 seconds        0.0.0.0:5000->5000/tcp                                               registry

验证registry是否可用

[root@centos01 ~]# docker pull ubuntuUsing default tag: latestTrying to pull repository docker.io/library/ubuntu ... latest: Pulling from docker.io/library/ubuntue0a742c2abfd: Pull complete 486cb8339a27: Pull complete dc6f0d824617: Pull complete 4f7a5649a30e: Pull complete 672363445ad2: Pull complete Digest: sha256:84c334414e2bfdcae99509a6add166bbb4fa4041dc3fa6af08046a66fed3005f[root@centos01 ~]# docker tag ubuntu localhost:5000/myfirstimage[root@centos01 ~]# docker push localhost:5000/myfirstimageThe push refers to a repository [localhost:5000/myfirstimage]26b126eb8632: Pushed 220d34b5f6c9: Pushed 8a5132998025: Pushed aca233ed29c3: Pushed e5d2f035d7a4: Pushed latest: digest: sha256:84c334414e2bfdcae99509a6add166bbb4fa4041dc3fa6af08046a66fed3005f size: 1357

end

原创粉丝点击