1. 在ubuntu14.04 上pull镜像redmine(注意版本为3.1.6)
docker pull redmine:3.1.6
2. 创建主机目录 /srv/redmine,将原主机上的compose.yml和run拷贝过来,将备份(files目录和redmine.db数据库文件)也拷贝过来
root@karl-v1:/srv/redmine# ls -ahl total 9.5M drwxr-xr-x 3 root root 4.0K May 8 11:16 . drwxr-xr-x 6 root root 4.0K May 7 16:01 .. -rw-r--r-- 1 root root 283 May 8 10:41 compose.yml drwxrwxr-x 6 999 docker 4.0K May 7 16:23 files -rw-r--r-- 1 999 docker 9.4M May 8 11:11 redmine.db -rwxr-xr-x 1 root root 2.2K May 7 16:00 run root@karl-v1:/srv/redmine#
3. 编辑compose.yml,将备份内容映射到容器中
root@karl-v1:/srv/redmine# cat compose.yml data: image: busybox entrypoint: /bin/true volumes: - /srv/redmine/files:/usr/src/redmine/files main: image: redmine:3.1.6 volumes_from: - data volumes: - /tmp:/tmp - /srv/redmine/redmine.db:/usr/src/redmine/sqlite/redmine.db ports: - "3000:3000" root@karl-v1:/srv/redmine#
4. 运行redmine容器
root@karl-v1:/srv/redmine# docker-compose -f compose.yml -p redmine up -d
5. 检查redmine容器是否正常运行,并验证redmine页面能否打开
## 检查redmine容器日志
root@karl-v1:/srv/redmine# docker logs redmine_main_1 warning: missing REDMINE_DB_MYSQL or REDMINE_DB_POSTGRES environment variables *** Using sqlite3 as fallback. *** Fetching gem metadata from https://rubygems.org/............... Fetching version metadata from https://rubygems.org/... Fetching dependency metadata from https://rubygems.org/.. Using rake 11.3.0 Using i18n 0.7.0 Using json 1.8.3 ... ... Using rails 4.2.5.2 Bundle complete! 32 Gemfile dependencies, 51 gems now installed. Gems in the groups development and test were not installed. Bundled gems are installed into /usr/local/bundle. /usr/local/bundle/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: duplicated key at line 466 ignored: "inodot" /usr/local/bundle/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: duplicated key at line 466 ignored: "inodot" /usr/local/bundle/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: duplicated key at line 466 ignored: "inodot" [2019-05-08 05:56:31] INFO WEBrick 1.3.1 [2019-05-08 05:56:31] INFO ruby 2.2.5 (2016-04-26) [x86_64-linux] [2019-05-08 05:56:31] INFO WEBrick::HTTPServer#start: pid=1 port=3000
## 在浏览器中输入 103.23.162.74:3000