我确定这是重复的主题,但我根本无法完成它:我想在运行时将数据库转储恢复到MySQL容器,而无需修改docker-compose.yml文件。
Docker文件
FROM php:5.4.45-apache
RUN apt-get update
RUN docker-php-ext-install mysql mysqli
Run Code Online (Sandbox Code Playgroud)
docker-compose.yml
version: '2'
services:
php_service:
container_name: my_php
# Use Dockerfile in this dir to build the image
build: .
# Stop containers always after exiting.
restart: always
ports:
# 'localhost' does not works from the host, but the IP of docker itself
# (192.168.99.100 for example - shown on the top of the console)
- "80:80"
- "443:443"
environment:
# Pass variables
- API_TOKEN=xxxx
volumes:
# The …Run Code Online (Sandbox Code Playgroud) 创建了一个repo,添加了包含以下内容的UTF8和Latin2编码文件:
árvízt?r? tükörfúrógép
ÁRVÍZT?R? TÜKÖRFÚRÓGÉP
Run Code Online (Sandbox Code Playgroud)
请参阅https://github.com/bimlas/git-test/commit/872370caf91f1faaf931c1228c797f3d10d6435d
输出git log -p 82904e60是:
commit 82904e60d1940c036c8190e2a41de6b423727a7c
Author: BimbaLaszlo <bimbalaszlo@gmail.com>
Date: Mon Jul 27 14:38:35 2015 +0200
initial commit
diff --git a/fileencoding/latin2.txt b/fileencoding/latin2.txt
new file mode 100644
index 0000000..7165bc9
--- /dev/null
+++ b/fileencoding/latin2.txt
@@ -0,0 +1,2 @@
+<E1>rv<ED>zt<FB>r<F5> t<FC>k<F6>rf<FA>r<F3>g<E9>p^M
+<C1>RV<CD>ZT<DB>R<D5> T<DC>K<D6>RF<DA>R<D3>G<C9>P^M
diff --git a/fileencoding/utf8.txt b/fileencoding/utf8.txt
new file mode 100644
index 0000000..80e1878
--- /dev/null
+++ b/fileencoding/utf8.txt
@@ -0,0 +1,2 @@
+árvízt?r? tükörfúrógép^M
+ÁRVÍZT?R? TÜKÖRFÚRÓGÉP^M
Run Code Online (Sandbox Code Playgroud)
我在Linux和Windows(我的语言环境是Latin2)上输出相同的输出.没有寻呼机(git --no-pager log -p 82904e60)尝试,没有转义码得到相同的结果:
commit 82904e6 …Run Code Online (Sandbox Code Playgroud) 我刚刚意识到我更喜欢直接将 TODO 注释写入最新的提交而不是问题跟踪器,例如:
TODO:
- Remove console.log
- Check that XY works
- ...
Run Code Online (Sandbox Code Playgroud)
例如,如果我必须切换到另一项工作,完成它并返回到这个分支,我可以看到我还没有完成什么,修复它,commit --amend从提交消息中删除 TODO 语句。
这是一个好习惯还是我应该强迫自己使用问题跟踪器并在那里写下每一个小注释(即使其他人可以看到该问题)?
我在 Windows 7 上使用 Boot2Docker 通过 Dockerfile 构建我的开发环境。当我运行时docker build -t myimage dir/of/docker/file,一切正常,直到这一行:
RUN git clone --verbose https://github.com/zsh-users/antigen ~/.antigen/antigen
Run Code Online (Sandbox Code Playgroud)
这一行的输出是:
Step 12 : RUN git clone --verbose https://github.com/zsh-users/antigen ~/.antigen/antigen
---> Running in 26cba91e912a
Cloning into '/root/.antigen/antigen'...
POST git-upload-pack (302 bytes)
---> e0012659884b
Removing intermediate container 26cba91e912a
Successfully built e0012659884b
Run Code Online (Sandbox Code Playgroud)
克隆(公共存储库的)被删除,容器中不存在 ~/.antigen/antigen。“克隆到...”是红色的,所以我认为命令有问题。但是如果我在容器的外壳(由docker run -it myimage)中运行它,它会克隆它。
我做错了什么,或者我可以做一些设置以git clone在 dockerfile 中使用吗?这是它的完整内容:
FROM debian:testing
MAINTAINER BimbaLaszlo
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y gcc …Run Code Online (Sandbox Code Playgroud) git ×3
docker ×2
boot2docker ×1
containers ×1
dump ×1
encoding ×1
git-clone ×1
mysql ×1
powershell ×1
restore ×1
todo ×1
utf-8 ×1
windows ×1