1.找到运行的容器文件所在目录 container id为docker容器文件目录名前缀
docker ps
[linjinyu@localhost ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
291eaa0040ff sebp/elk "/usr/local/bin/star…" 4 days ago Up 4 hours 0.0.0.0:4560->4560/tcp, 0.0.0.0:5044->5044/tcp, 0.0.0.0:5601->5601/tcp, 0.0.0.0:9200->9200/tcp, 9300/tcp elk
df -h
2.停止容器以及docker服务
docker stop 容器名或id
systemctl stop docker
3.到容器目录下,编辑hostconfig.json和config.v2.json文件并增加新的端口内容
centos容器路径 docker 的镜像与容器都存储在 /var/lib/docker 下面
cd /disk01/docker/containers/9ed10c999ae3.....
vi hostconfig.json
vi hconfig.v2.json
4.修改后启动docker并启动该容器,docker ps 检查端口是否增加
想要修改contrainer的config.v2.json
hostconfig.json
一定要关闭docker stop 291eaa0040ff
service docker stop
,不然config.v2.json
hostconfig.json
会恢复原样
sebp/elk
sudo docker run -p 5601:5601 -p 9200:9200 -p 5044:5044 -it --name elk sebp/elk
sudo docker run -p 5601:5601 -p 9200:9200 -p 5044:5044 -it --name elk sebp/elk
程序员果果用法
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -p 5601:5601 -p 5044:5044 -p 9200:9200 -p 9300:9300 -it --name elk 2fbf0a30426d
docker start 291eaa0040ff
docker exec -it elk /bin/bash
docker exec -it elk /bin/bash
使用 control + P + Q 退出容器 出处
与 exit退出
与 ctrl + C 退出有什么不一样?
docker 的镜像与容器都存储在 /var/lib/docker 下面
进入容器后的改动,例如 目录 1 .bak文件再次进入时还是有的
gelf 4560
filebeats 5044
elasticsearch 9200
kibana 5601
echo $LOGSTASH_HOME -> /opt/logstash
echo $ES_HOME -> /opt/elasticsearch
config.v2.json
{
"StreamConfig": {},
"State": {
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"RemovalInProgress": false,
"Dead": false,
"Pid": 0,
"ExitCode": 0,
"Error": "",
"StartedAt": "2019-04-29T03:45:54.322278548Z",
"FinishedAt": "2019-04-29T03:46:46.687701755Z",
"Health": null
},
"ID": "291eaa0040ff1023ccde0595e047a4e089b9e307cbcb6dbd5ebba993aa952d61",
"Created": "2019-04-25T02:45:59.634297527Z",
"Managed": false,
"Path": "/usr/local/bin/start.sh",
"Args": [],
"Config": {
"Hostname": "291eaa0040ff",
"Domainname": "",
"User": "",
"AttachStdin": true,
"AttachStdout": true,
"AttachStderr": true,
"ExposedPorts": {
"4560/tcp": {},
"5044/tcp": {},
"5601/tcp": {},
"9200/tcp": {},
"9300/tcp": {}
},
"Tty": true,
"OpenStdin": true,
"StdinOnce": true,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"DEBIAN_FRONTEND=teletype",
"LANG=en_US.UTF-8",
"LANGUAGE=en_US:en",
"LC_ALL=en_US.UTF-8",
"REFRESHED_AT=2017-02-28",
"GOSU_VERSION=1.10",
"JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre",
"ELK_VERSION=7.0.0",
"ES_VERSION=7.0.0",
"ES_HOME=/opt/elasticsearch",
"ES_PACKAGE=elasticsearch-7.0.0-linux-x86_64.tar.gz",
"ES_GID=991",
"ES_UID=991",
"ES_PATH_CONF=/etc/elasticsearch",
"ES_PATH_BACKUP=/var/backups",
"LOGSTASH_VERSION=7.0.0",
"LOGSTASH_HOME=/opt/logstash",
"LOGSTASH_PACKAGE=logstash-7.0.0.tar.gz",
"LOGSTASH_GID=992",
"LOGSTASH_UID=992",
"LOGSTASH_PATH_CONF=/etc/logstash",
"LOGSTASH_PATH_SETTINGS=/opt/logstash/config",
"KIBANA_VERSION=7.0.0",
"KIBANA_HOME=/opt/kibana",
"KIBANA_PACKAGE=kibana-7.0.0-linux-x86_64.tar.gz",
"KIBANA_GID=993",
"KIBANA_UID=993"
],
"Cmd": [
"/usr/local/bin/start.sh"
],
"ArgsEscaped": true,
"Image": "sebp/elk",
"Volumes": {
"/var/lib/elasticsearch": {}
},
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"Image": "sha256:58b7fc416e598a6ddc492b853be3621f5cf66d56a0bd19a50bf759ec45ef3932",
"NetworkSettings": {
"Bridge": "",
"SandboxID": "1b1a0d06440065ff3e0e19678dacb04bfe1870dbc41babc6d27c4b2e3c56221b",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "ad472df1fe63b9ca08fdd51f2be06f6d83cba2e66243a1c7ce291bb27c392fc1",
"EndpointID": "",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null,
"IPAMOperational": false
}
},
"Service": null,
"Ports": null,
"SandboxKey": "/var/run/docker/netns/1b1a0d064400",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"IsAnonymousEndpoint": false,
"HasSwarmEndpoint": false
},
"LogPath": "/var/lib/docker/containers/291eaa0040ff1023ccde0595e047a4e089b9e307cbcb6dbd5ebba993aa952d61/291eaa0040ff1023ccde0595e047a4e089b9e307cbcb6dbd5ebba993aa952d61-json.log",
"Name": "/elk",
"Driver": "devicemapper",
"OS": "linux",
"MountLabel": "",
"ProcessLabel": "",
"RestartCount": 0,
"HasBeenStartedBefore": true,
"HasBeenManuallyStopped": true,
"MountPoints": {
"/var/lib/elasticsearch": {
"Source": "",
"Destination": "/var/lib/elasticsearch",
"RW": true,
"Name": "3abc0cd5ceae0bf56a2f949dd80e3532fba6977a1ef5d125afff114a20f094c4",
"Driver": "local",
"Type": "volume",
"Spec": {},
"SkipMountpointCreation": false
}
},
"SecretReferences": null,
"ConfigReferences": null,
"AppArmorProfile": "",
"HostnamePath": "/var/lib/docker/containers/291eaa0040ff1023ccde0595e047a4e089b9e307cbcb6dbd5ebba993aa952d61/hostname",
"HostsPath": "/var/lib/docker/containers/291eaa0040ff1023ccde0595e047a4e089b9e307cbcb6dbd5ebba993aa952d61/hosts",
"ShmPath": "/var/lib/docker/containers/291eaa0040ff1023ccde0595e047a4e089b9e307cbcb6dbd5ebba993aa952d61/mounts/shm",
"ResolvConfPath": "/var/lib/docker/containers/291eaa0040ff1023ccde0595e047a4e089b9e307cbcb6dbd5ebba993aa952d61/resolv.conf",
"SeccompProfile": "",
"NoNewPrivileges": false
}
hostconfig.json
{
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"5044/tcp": [{
"HostIp": "",
"HostPort": "5044"
}],
"5601/tcp": [{
"HostIp": "",
"HostPort": "5601"
}],
"9200/tcp": [{
"HostIp": "",
"HostPort": "9200"
}]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "shareable",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DiskQuota": 0,
"KernelMemory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/asound",
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
}
Original url: Access
Created at: 2019-04-29 11:19:46
Category: default
Tags: none
未标明原创文章均为采集,版权归作者所有,转载无需和我联系,请注明原出处,南摩阿彌陀佛,知识,不只知道,要得到
最新评论