Docker builds Ethereum private chain
Publish: 2021-05-14 04:39:09
1. This needs to be recharged, but we must pay attention to the risk. This chain is not particularly mainstream. It may be the capital disk or counterfeit currency.
2. Build / env.sh go run build / ci.go install. / CMD / geth
make: * * [geth] error 1
there is no such directory, or the directory has insufficient permissions
make: * * [geth] error 1
there is no such directory, or the directory has insufficient permissions
3. Yes, but it is better to use overseas servers. In addition, the server configuration should be medium or above.
4. Docker is a very useful virtualization tool
the method of establishing private docker hub is given below. Docker packages the environment of private hub in registry image
execute instruction:
docker run - P 5000:5000 registry
this instruction starts a cotainer based on registry image. And bind port 5000 of host to port 5000 of virtual machine
in this way, any access to the host port 5000 is transferred to the virtual machine
upload image:
first give image a tag
docker tag $ID $IP: $port / $name
for example, docker tag b832n2b87 192.168.1.1:5000/vim
ID is the ID of image, IP is the IP of host host, name is the name of the image
docker push 192.168.1.1:5000/vim
Download Image:
docker pull 192.168.1.1:5000/vim
the method of establishing private docker hub is given below. Docker packages the environment of private hub in registry image
execute instruction:
docker run - P 5000:5000 registry
this instruction starts a cotainer based on registry image. And bind port 5000 of host to port 5000 of virtual machine
in this way, any access to the host port 5000 is transferred to the virtual machine
upload image:
first give image a tag
docker tag $ID $IP: $port / $name
for example, docker tag b832n2b87 192.168.1.1:5000/vim
ID is the ID of image, IP is the IP of host host, name is the name of the image
docker push 192.168.1.1:5000/vim
Download Image:
docker pull 192.168.1.1:5000/vim
5. Environment preparation
environment: two Ubuntu virtual machines with docker
virtual machine 1: 192.168.112.132 user development machine
virtual machine 2: 192.168.112.136 used as private warehouse
here we prepare two virtual machines with docker installed, 132 as development machine and 136 as registry private warehouse machine. After the environment is ready, we will start to build the private image warehouse
build a private warehouse
first, download the registry image on 136 machine
$sudo docker pull registry
after downloading, we start a container through the image
$sudo docker run - D - P 5000:5000 registry
by default, the warehouse will be stored in the / TMP / registry directory in the container, so that if the container is deleted, The image stored in the container will also be lost, so we usually specify a local directory to mount to / TMP / registry in the container, as follows:
$sudo docker run - D - P 5000:5000 - V / opt / data / registry / TMP / registry
you can see that we started a container with the address of 192.168.112.136:5000
test
next, we need to push a local image into the private warehouse. First of all, pull a relatively small image under 132 machine to test (busybox is used here)
$sudo docker pull busybox
next, modify the tag of the image
$sudo docker tag busybox 192.168.112.136:5000 / busybox
next, upload the tagged image to the private warehouse
$sudo docker push 192.168.112.136:5000 / busybox
you can see that the push failed with the following error:
2015 / 01 / 05 11:01:17 error: invalid registry endpoint https://192.168.112.136 :5000/v1/: Get https://192.168.112.136 :5000/v1/_ ping: dial tcp 192.168.112.136:5000: connection refused. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry 192.168.112.136:5000` to the daemon' s arguments. In the case of HTTPS, if you have access to the registry' s CA certificate, no need for the flag; Simply place the CA certificate at / etc / docker / certs.d/192.168.112.136:5000 / ca.crt 11
because docker interacts with docker registry after 1.3. X, the default is HTTPS. However, the private warehouse built here only provides HTTP service, so the above error will be reported when interacting with the private warehouse. In order to solve this problem, we need to add the startup parameter when starting docker server to use HTTP access by default. Modify the docker startup configuration file (here is to modify the configuration of 132 machine). The address of the configuration file under Ubuntu is / etc / init / docker.conf, and add – insert registry 192.168.112.136:5000 as follows:
$sudo VI / etc / init / docker.conf
after modification, restart the docker service
$sudo restart docker
after the restart, we run the push command again to push the local image to the private server
$sudo docker push 192.168.112.136:5000 / busybox
you can see that the image has been pushed into the private warehouse
next, we delete the local image and pull it from the private warehouse
$sudo docker pull 192.168.112.136:5000 / busybox
here is the docker private warehouse. The above warehouse does not need authentication. We can use nginx and HTTPS to realize authentication and encryption.
environment: two Ubuntu virtual machines with docker
virtual machine 1: 192.168.112.132 user development machine
virtual machine 2: 192.168.112.136 used as private warehouse
here we prepare two virtual machines with docker installed, 132 as development machine and 136 as registry private warehouse machine. After the environment is ready, we will start to build the private image warehouse
build a private warehouse
first, download the registry image on 136 machine
$sudo docker pull registry
after downloading, we start a container through the image
$sudo docker run - D - P 5000:5000 registry
by default, the warehouse will be stored in the / TMP / registry directory in the container, so that if the container is deleted, The image stored in the container will also be lost, so we usually specify a local directory to mount to / TMP / registry in the container, as follows:
$sudo docker run - D - P 5000:5000 - V / opt / data / registry / TMP / registry
you can see that we started a container with the address of 192.168.112.136:5000
test
next, we need to push a local image into the private warehouse. First of all, pull a relatively small image under 132 machine to test (busybox is used here)
$sudo docker pull busybox
next, modify the tag of the image
$sudo docker tag busybox 192.168.112.136:5000 / busybox
next, upload the tagged image to the private warehouse
$sudo docker push 192.168.112.136:5000 / busybox
you can see that the push failed with the following error:
2015 / 01 / 05 11:01:17 error: invalid registry endpoint https://192.168.112.136 :5000/v1/: Get https://192.168.112.136 :5000/v1/_ ping: dial tcp 192.168.112.136:5000: connection refused. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry 192.168.112.136:5000` to the daemon' s arguments. In the case of HTTPS, if you have access to the registry' s CA certificate, no need for the flag; Simply place the CA certificate at / etc / docker / certs.d/192.168.112.136:5000 / ca.crt 11
because docker interacts with docker registry after 1.3. X, the default is HTTPS. However, the private warehouse built here only provides HTTP service, so the above error will be reported when interacting with the private warehouse. In order to solve this problem, we need to add the startup parameter when starting docker server to use HTTP access by default. Modify the docker startup configuration file (here is to modify the configuration of 132 machine). The address of the configuration file under Ubuntu is / etc / init / docker.conf, and add – insert registry 192.168.112.136:5000 as follows:
$sudo VI / etc / init / docker.conf
after modification, restart the docker service
$sudo restart docker
after the restart, we run the push command again to push the local image to the private server
$sudo docker push 192.168.112.136:5000 / busybox
you can see that the image has been pushed into the private warehouse
next, we delete the local image and pull it from the private warehouse
$sudo docker pull 192.168.112.136:5000 / busybox
here is the docker private warehouse. The above warehouse does not need authentication. We can use nginx and HTTPS to realize authentication and encryption.
6. Environment: two Ubuntu virtual machines with docker
virtual machine 1: 192.168.112.132 user development machine
virtual machine 2: 192.168.112.136 used as private warehouse
here we prepare two virtual machines with docker installed, 132 as development machine and 136 as registry private warehouse machine. After the environment is ready, we will start to build the private image warehouse
build a private warehouse
first download the registry image on 136 machine
$sudo docker pull registry
after downloading, we start a container through the image
$sudo Docker run - D - P 5000:5000 registry
by default, the warehouse will be stored in the container's / TMP / registry directory, so that if the container is deleted, The image stored in the container will also be lost, so we usually specify a local directory to mount to the container's / TMP / registry, as follows:
$sudo docker run - D - P 5000:5000 - V / opt / data / registry / TMP / registry
you can see that we started a container, The address is 192.168.112.136:5000
next, we need to push a local image into the private warehouse
pull a relatively small image under 132 machine to test (busybox is used here)
$sudo docker pull busybox
next, modify the tag of the image
$sudo docker tag busybox 192.168.112.136:5000/ Busybox
next, upload the tagged image to private server
$sudo docker push 192.168.112.136:5000/busybox
virtual machine 1: 192.168.112.132 user development machine
virtual machine 2: 192.168.112.136 used as private warehouse
here we prepare two virtual machines with docker installed, 132 as development machine and 136 as registry private warehouse machine. After the environment is ready, we will start to build the private image warehouse
build a private warehouse
first download the registry image on 136 machine
$sudo docker pull registry
after downloading, we start a container through the image
$sudo Docker run - D - P 5000:5000 registry
by default, the warehouse will be stored in the container's / TMP / registry directory, so that if the container is deleted, The image stored in the container will also be lost, so we usually specify a local directory to mount to the container's / TMP / registry, as follows:
$sudo docker run - D - P 5000:5000 - V / opt / data / registry / TMP / registry
you can see that we started a container, The address is 192.168.112.136:5000
next, we need to push a local image into the private warehouse
pull a relatively small image under 132 machine to test (busybox is used here)
$sudo docker pull busybox
next, modify the tag of the image
$sudo docker tag busybox 192.168.112.136:5000/ Busybox
next, upload the tagged image to private server
$sudo docker push 192.168.112.136:5000/busybox
7. ; BIND data file for local loopback interface
;
$TTL 86400
@ IN SOA ns.rd. root.rd. (
2014032802 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.rd.
@ IN A 218.8.7.6
ns IN A 218.8.7.6
www IN A 218.8.7.6
repos IN A 218.8.7.6
;
$TTL 86400
@ IN SOA ns.rd. root.rd. (
2014032802 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.rd.
@ IN A 218.8.7.6
ns IN A 218.8.7.6
www IN A 218.8.7.6
repos IN A 218.8.7.6
8. Unknown_Error
9. If docker is installed successfully, there will be a virtual network card, The default IP address is 172.17.42.1
use docker
search
centos6 command to search containers in githop
use docker
pull
weepee / centos6 to download containers locally
use docker
images to view all containers locally
use run command to start containers
/ usr / bin / docker
Run
- d
- V
/ root / root
- P
81:80
- P < B r />2222:22
-p
10050:10050
-p
10051:10051
centos6.5_ zabbix:v1.3
remember centos6.5_ zabbix:v1.3 It is the port of the host in front of the name and version number found in the fourth step
81:80
and the port opened by the container in docker, There is a mapping relationship between the two ports
6
docker
ps
container for viewing the running status
7
If docker
commit
859549d3f157 is used to submit modification, then container
ID is queried by docker
PS
use docker
search
centos6 command to search containers in githop
use docker
pull
weepee / centos6 to download containers locally
use docker
images to view all containers locally
use run command to start containers
/ usr / bin / docker
Run
- d
- V
/ root / root
- P
81:80
- P < B r />2222:22
-p
10050:10050
-p
10051:10051
centos6.5_ zabbix:v1.3
remember centos6.5_ zabbix:v1.3 It is the port of the host in front of the name and version number found in the fourth step
81:80
and the port opened by the container in docker, There is a mapping relationship between the two ports
6
docker
ps
container for viewing the running status
7
If docker
commit
859549d3f157 is used to submit modification, then container
ID is queried by docker
PS
Hot content