我正在尝试将环境变量设置为Dockerfile中的当前构建目录。例如,我正在尝试做这样的事情:
ENV APP_SRC $BUILD_CONTEXT # Save the current host directory to an env variable
COPY . /$APP_SRC # Copy the app source code to a directory of the same name in the container
我知道这听起来很奇怪,但我需要我的目录名在容器中与在我的主机上相同。这可能吗?
答案 0 :(得分:1)
使用docker 1.9,您可以传递build-time environment variable:
$BUILD_CONTEXT
var i = 0;
function myFunction() {
setInterval(function() {
var table = document.getElementById("myTable");
var row = table.insertRow(0);
var cell1 = row.insertCell(0);
cell1.id = i;
cell1.addEventListener("click",function(){
alert(this.id);
});
cell1.innerHTML = "aaaaa";
i++;
},1000);
}
的价值将与#include <iostream>
#include <vector>
#include <algorithm>
#include <boost/align/aligned_allocator.hpp>
using namespace std;
struct alignas(64) A { };
struct B { };
template <int _AlignT = 64, typename _ContainerT>
bool is_aligned(_ContainerT&& c)
{
return all_of(begin(c), end(c), [](auto& e) { return (ptrdiff_t)&e % _AlignT == 0; });
}
int main()
{
std::vector<A, boost::alignment::aligned_allocator<A>> va(3);
cout << "A aligned:" << boolalpha << is_aligned(va) << endl;
std::vector<B, boost::alignment::aligned_allocator<B, 64>> vb(3);
cout << "B aligned:" << boolalpha << is_aligned(vb) << endl;
for_each(begin(vb), end(vb), [](auto& e) { cout << (void*)&e << endl; });
return 0;
}
相同。
请注意,docker compose尚不支持此功能:issue 2111和2163都要求该功能。