如何运行Hyperledger Composer Rest Server Docker映像? [英] How to run Hyperledger Composer Rest Server docker image?

查看:72
本文介绍了如何运行Hyperledger Composer Rest Server Docker映像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经提取了hyperledger / composer-rest-server码头工人镜像,现在,如果我想运行该码头工人镜像,那么我应该在哪个端口上公开?就像下面提到的。

docker run --name composer-rest-server --publish XXXX:YYYY --detach hyperledger / composer-rest-server

在这里请告诉我我应该用XXXX&代替什么? YYYY?

解决方案

我使用以下命令在容器中运行其余服务器:

  docker run -d \ 
-e COMPOSER_CARD = admin @ test-net \
-e COMPOSER_NAMESPACES = never \ \
-v〜/ .composer:/home/composer/.composer \
--name rest -p 3000:3000 \
hyperledger / composer-rest-server

对于发布的端口,第一个元素是将在Docker主机上使用的端口,第二个元素是将端口转发到容器内部。 (默认情况下,容器内的端口始终为3000,更改起来更复杂。)认识到-命名空间只是使端点保持简单,但是COMPOSER_CARD对于REST服务器正常启动至关重要。



我还在Docker主机和主机之间共享一个卷。 的存储容器,以便REST服务器可以找到环境变量中引用的COMPOSER_CARD。



警告::如果您尝试使用Development Fabric测试REST服务器,则需要了解Docker容器的IP网络和地址-默认情况下,Composer商业网卡将使用 localhost 构建em>作为Fabric服务器的地址,但是您不能在REST服务器容器中使用 localhost ,因为它将在容器内重定向并无法找到Fabr我知道了。



其中有一个教程专注于多用户身份验证的Composer文档,但它也涵盖了使用REST服务器容器的网络方面。在此处


I have pulled hyperledger/composer-rest-server docker image , Now if i wanted to run this docker image then on which port should i expose ? Like mentioned below.
docker run --name composer-rest-server --publish XXXX:YYYY --detach hyperledger/composer-rest-server
Here please tell me what should i replace for XXXX & YYYY ?

解决方案

I run the rest server in a container using a command as follows:

docker run -d \ 
-e COMPOSER_CARD="admin@test-net" \ 
-e COMPOSER_NAMESPACES="never" \ 
-v ~/.composer:/home/composer/.composer \ 
--name rest -p 3000:3000 \ 
hyperledger/composer-rest-server

For the Published Port, the first element is the Port that will be used on the Docker Host, and the second is the Port it is forwarded to inside the container. (The Port inside the container will always be 3000 by default and is more complex to change.)

I'm passing 2 environment variables into the Container which the REST server will recognise - Namespaces just keeps the endpoints simple, but the COMPOSER_CARD is essential for the REST server to start properly.

I'm also sharing a volume between the Docker Host and the Container which is where the Cards are stored, so that the REST server can find the COMPOSER_CARD referred to in the environment variable.

Warning: If you are trying to test the REST server with the Development Fabric you need to understand the IP Network and Addressing of the Docker containers - by default the Composer Business Network Cards will be built using localhost as the address of the Fabric servers, but you can't use localhost in the REST server container as that will redirect inside the container and fail to find the Fabric.

There is a tutorial in the Composer Docs that is focused on Multi-User authentication, but it does also cover the networking aspects of using the REST Server Container. There is general information about the REST server here.

这篇关于如何运行Hyperledger Composer Rest Server Docker映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆