基于Docker的集成开发环境包含gvim&Emacs
拉取镜像,docker pull jiftle/dev-env:latest
README
Intr
Dev-Env is Develop Envir with vim & emacs, golang & node. It soupport x11 gui apps, contain gvim ,emacs ,eclipse.
Include
base apps
- xz-utils - tree - curl - wget - htop - nmap - git - tig
build-env
- build-essential - gcc - g++ - make - cmake
lang-dev
- golang 1.14.2 - node 14.1.0
x11 gui apps
- gvim 8.2 - emacs 26.3 - eclipse 4.15.0 (2020-03)
How To Use
MacOS 10.15.4
% cat conf.cnf #!/bin/bash # ----------------------------------------------------------------- # FileName: conf.cnf # Date: 2020-01-09 # Author: jiftle # Description: # ----------------------------------------------------------------- DockerKey="jiftle/dev-env" DockerVer="1.0" DockerName="dev-env" # ------- 处理GUI显示的问题,原理:x11共享 ------- IP=$(ifconfig en0 | grep inet | awk ‘$1=="inet" {print $2}‘) % cat run.sh #!/bin/bash # ----------------------------------------------------------------- # FileName: run.sh # Date: 2020-01-09 # Author: jiftle # Description: # ----------------------------------------------------------------- . ./conf.cnf echo " |--> 当前主机IP: $IP" # --------------- 定义变量 ------------------ GitPath="${HOME}/tg-git" HostIp="$IP" echo "------------- 运行[${DockerKey}:${DockerVer}]镜像的容器 ------------" echo "---> 开始启动[${DockerKey}:${DockerVer}] Docker" # -e GDK_SCALE # -e GDK_DPI_SCALE # ----------- 运行容器 ------------ docker run -itd `# 注释请忽略,----------- 设置名称 -------------` --name="${DockerName}" `# 注释请忽略,----------- 工作目录映射 -------------` -w /root `# 默认工作目录` -v ${HOME}:/home/john `# 默认工作目录,映射` -v ${GitPath}:/home/john/git `# git仓库目录` `# 注释请忽略,----------- 用户密钥 -------------` -v ${HOME}/.ssh:/root/.ssh `# .ssh密钥` `# 注释请忽略,----------- 端口映射 -------------` -p 8022:22 `# ssh端口` -p 8001:8001 `# 日志仓库,预览服务` -p 8080:8080 `# web程序调试端口` -h "${DockerName}" `# 机器名` --restart=always `# 自启动,容易导致挂载的分区,晚于docker` `# 注释请忽略,----------- 图形界面 -------------` -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=${HostIp}:0 `# 镜像名` ${DockerKey}:${DockerVer} echo "---> 启动[${DockerKey}:${DockerVer}] Docker完毕" % cat exec.sh #!/bin/bash # ----------------------------------------------------------------- # FileName: exec.sh # Date: 2020-01-09 # Author: jiftle # Description: # ----------------------------------------------------------------- . ./conf.cnf # echo " |--> 当前主机IP: $IP" # xhost + $IP # docker exec -it -e DISPLAY=$IP:0 dev-env bash echo " |--> 当前主机IP: $IP" xhost + $IP docker exec -it -e DISPLAY=$IP:0 ${DockerName} bash # ------------ 不显示IP地址 # xhost + # docker exec -it -e DISPLAY=:0 dev-env bash # xhost + # docker exec -it dev-env bash # docker exec -it ${DockerKey} bash
Deepin linux 15.11
% cat config.cnf #!/bin/bash # ----------------------------------------------------------------- # FileName: commit.sh # Date: 2020-01-17 # Author: jiftle # Description: 提交当前镜像 # ----------------------------------------------------------------- DockerKey="dev-env" # DockerVer="0.1" # DockerVer="latest" DockerVer="eclipse3.8" DockerName="开发环境" % cat run.sh #!/bin/bash # ----------------------------------------------------------------- # FileName: run.sh # Date: 2020-01-09 # Author: jiftle # Description: # ----------------------------------------------------------------- . config.cnf # --------------- 定义变量 ------------------ GitPath="/usrlocal/git" MavenPath="/usrlocal/maven" echo "================= [${DockerName}(${DockerKey}:${DockerVer}] ====================" echo "---> 设置x11访问控制" xhost + echo " |--> [${DockerName}(${DockerKey}:${DockerVer}] 开始启动..." # ----------- 运行容器 ------------ docker run -it `# 注释请忽略,----------- 设置容器实例名称 -------------` --name="${DockerKey}" `# 注释请忽略,----------- 工作目录映射 -------------` -w /root `# 默认工作目录` -v ${HOME}:/home/john `# 默认工作目录,映射` -v ${GitPath}:/home/john/git `# git仓库目录` -v ${MavenPath}:/home/john/maven `# maven仓库目录` `# 注释请忽略,----------- 用户密钥 -------------` -v ${HOME}/.ssh:/root/.ssh `# .ssh密钥,需要具有写权限` `# 注释请忽略,----------- 端口映射 -------------` -p 8001:8001 `# 日志仓库,预览服务` -p 8080:8080 `# web程序调试端口` `# 注释请忽略,----------- 解决时区问题 -------------` -v /etc/localtime:/etc/localtime:ro -h "${DockerKey}" `# 机器名` `# --cpuset-cpus="0" # 指定使用CPU的编号` `# -m 2G # 限制最大内存占用` --privileged `# --memory-swap=4G # 交换内存` --restart=always `# 自启动,容易导致挂载的分区,晚于docker,使用时做好磁盘挂载,建议修改/etc/fstab` `# -------------- GUI程序设置 ----------------` -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY --cap-add=SYS_PTRACE --security-opt seccomp=unconfined `# 解决dlv调试附加失败的问题` `# 镜像名` ${DockerKey}:${DockerVer} /sbin/init echo " |--> [${DockerName}(${DockerKey}:${DockerVer}] 启动成功. ^-^" % cat exec.sh #!/bin/bash # ----------------------------------------------------------------- # FileName: exec.sh # Date: 2020-01-09 # Author: jiftle # Description: # ----------------------------------------------------------------- . config.cnf docker exec -it ${DockerKey} bash
ScreenShot
- MacOs
相关推荐
kekenow 2020-06-02
kekenow 2020-05-27
applecarelte 2020-05-17
hell0kitty 2020-05-06
严谨死板君 2020-04-26
猫师 2020-03-16
Watanuki00 2020-02-19
nixebo 2020-02-02
Watanuki00 2020-01-31
Watanuki00 2019-11-18
kekenow 2019-10-22
Jouen 2011-09-18
DeanChen 2012-02-21
nixebo 2019-04-04
御前带刀侍卫 2014-12-19
suncrx 2014-12-12
robertzhouxh 2014-03-10
suncrx 2013-03-11