基于 Docker 安装 IPFS
基于 Docker 安装 IPFS查看 IPFS 镜像语法:docker search ipfs示例:[root@izbp13xko46hud9vfr5s94z ~]# docker search ipfsNAMEDESCRIPTION...
·
基于 Docker 安装 IPFS
查看 IPFS 镜像
- 语法:
docker search ipfs
- 示例:
[root@izbp13xko46hud9vfr5s94z ~]# docker search ipfs
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
ipfs/go-ipfs Go implementation of IPFS, the InterPlanetar… 42 [OK]
jbenet/go-ipfs 18 [OK]
ipfs/ipfs-cluster Collective pinning and composition for IPFS. 1 [OK]
ipfs/ipfs-cluster-test Container used to test ipfs-cluster with kub… 1 [OK]
maybebtc/go-ipfs 1 [OK]
mkg20001/ipfs-docker-webserver IPFS webserver powered by apache2 as docker … 1 [OK]
qnib/ipfs Docker image to integrate ipfs into QNIBTerm… 1 [OK]
hanuprateek/zenko-ipfs-module 0
victorbjelkholm/ipfsbin ipfsbin 0 [OK]
pataquets/beets-ipfs beets-ipfs 0 [OK]
nannal/ipfs 0
zenground0/ipfs-cluster 0
ipfs/js-ipfs IPFS implementation in JavaScript 0 [OK]
brimstone/ipfs Inter Planetary File System 0
compulsivecoder/ubuntu-mono-ipfs A container for running mono and ipfs on ubu… 0 [OK]
blockchainlg/ipfs-service 0
guruvan/go-ipfs 0
controlplane/kubernetes-ipfs 0
ademord/ipfs-peer 0
joshorig/ipfs-cluster-k8s-sidecar 0
controlplane/ipfs-cluster-test 0
rtlong/ipfs Tiny static builds of the IPFS binary ~13MB 0
whyrusleeping/ipfs-blkchn 0
aragon/ipfs 0
andrewdotnich/docker-ipfs Docker container to run an IPFS node. http:/… 0 [OK]
[root@izbp13xko46hud9vfr5s94z ~]#
获取 IPFS镜像
从查询出来的镜像列表中选择一个即可,这里选择ipfs/go-ipfs
。
- 语法:
docker pull ipfs/go-ipfs
- 示例:
[root@izbp13xko46hud9vfr5s94z ~]# docker pull ipfs/go-ipfs
Using default tag: latest
latest: Pulling from ipfs/go-ipfs
5497949500d2: Pull complete
9cfd2e6d2b64: Downloading [===================> ] 5.213MB/13.13MB
8167893b973a: Download complete
0f61f69d653d: Download complete
8a98c133507f: Download complete
9cfd2e6d2b64: Pull complete
8167893b973a: Pull complete
0f61f69d653d: Pull complete
8a98c133507f: Pull complete
e9bc9df9b0ba: Pull complete
b5b58acfc7ee: Pull complete
385a82e0ccbb: Pull complete
Digest: sha256:31cc5713ef3e3e81bf868cbb56c19de2d15d661743d8b6077804dee26e929ac5
Status: Downloaded newer image for ipfs/go-ipfs:latest
[root@izbp13xko46hud9vfr5s94z ~]#
实例化一个IPFS容器实例
- 语法:
docker run -d --name ipfs_host -v /develop/ipfs/export:/export -v /develop/ipfs/data:/data/ipfs -p 4001:4001 -p 127.0.0.1:8181:8181 -p 127.0.0.1:5001:5001 ipfs/go-ipfs:latest
- 示例:
[root@izbp13xko46hud9vfr5s94z ~]# docker run -d --name ipfs_host -v /develop/ipfs/export:/export -v /develop/ipfs/data:/data/ipfs -p 4001:4001 -p 127.0.0.1:8181:8181 -p 127.0.0.1:5001:5001 ipfs/go-ipfs:latest
49e2db3bd0fff0d2740b992ae049f9a8d5c62915af4111b9487d0c4b752ed7a3
[root@izbp13xko46hud9vfr5s94z ~]#
查看IPFS日志
- 语法:
docker logs -f ipfs_host
- 示例:
[root@izbp13xko46hud9vfr5s94z ~]# docker logs -f ipfs_host
Changing user to ipfs
ipfs version 0.4.15
Found IPFS fs-repo at /data/ipfs
Initializing daemon...
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/172.17.0.2/tcp/4001
Swarm listening on /p2p-circuit/ipfs/Qmf8LCedmUMnhXJZA8FHdqkWqm1C4traJAVDEfjsmmBo5E
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/172.17.0.2/tcp/4001
API server listening on /ip4/0.0.0.0/tcp/5001
Gateway (readonly) server listening on /ip4/0.0.0.0/tcp/8080
Daemon is ready
当看到以下内容的时,说明IPFS正在运行:
Gateway (readonly) server
listening on /ip4/0.0.0.0/tcp/8080
运行IPFS命令
- 语法:
docker exec ipfs_host ipfs <args...>
- 示例:
进入IPFS容器
- 语法:
docker exec -it ipfs_host /bin/sh
- 示例:
[root@izbp13xko46hud9vfr5s94z ~]# docker exec -it ipfs_host /bin/sh
/ #
在当前终端容器可输入IPFS命令,例如输入ipfs
[root@izbp13xko46hud9vfr5s94z ~]# docker exec -it ipfs_host /bin/sh
/ # ipfs
USAGE
ipfs - Global p2p merkle-dag filesystem.
ipfs [--config=<config> | -c] [--debug=<debug> | -D] [--help=<help>] [-h=<h>] [--local=<local> | -L] [--api=<api>] <command> ...
SUBCOMMANDS
BASIC COMMANDS
init Initialize ipfs local configuration
add <path> Add a file to IPFS
cat <ref> Show IPFS object data
get <ref> Download IPFS objects
ls <ref> List links from an object
refs <ref> List hashes of links from an object
DATA STRUCTURE COMMANDS
block Interact with raw blocks in the datastore
object Interact with raw dag nodes
files Interact with objects as if they were a unix filesystem
dag Interact with IPLD documents (experimental)
ADVANCED COMMANDS
daemon Start a long-running daemon process
mount Mount an IPFS read-only mountpoint
resolve Resolve any type of name
name Publish and resolve IPNS names
key Create and list IPNS name keypairs
dns Resolve DNS links
pin Pin objects to local storage
repo Manipulate the IPFS repository
stats Various operational stats
p2p Libp2p stream mounting
filestore Manage the filestore (experimental)
NETWORK COMMANDS
id Show info about IPFS peers
bootstrap Add or remove bootstrap peers
swarm Manage connections to the p2p network
dht Query the DHT for values or peers
ping Measure the latency of a connection
diag Print diagnostics
TOOL COMMANDS
config Manage configuration
version Show ipfs version information
update Download and apply go-ipfs updates
commands List all available commands
Use 'ipfs <command> --help' to learn more about each command.
ipfs uses a repository in the local file system. By default, the repo is
located at ~/.ipfs. To change the repo location, set the $IPFS_PATH
environment variable:
export IPFS_PATH=/path/to/ipfsrepo
EXIT STATUS
The CLI will exit with one of the following values:
0 Successful execution.
1 Failed executions.
/ #
参考链接:
https://github.com/ipfs/go-ipfs#docker-usage
https://my.oschina.net/u/2306127/blog/1613968
更多推荐
已为社区贡献7条内容
所有评论(0)