cURL请求挂在docker ubuntu / alpine容器中

时间:2018-08-28 18:29:34

标签: docker curl networking tcp

我在安装docker的地方有一个digitalocean Droplet。在像这样def classify_stack(data, model, out_location=None): final_shape = 1, data.shape[1], data.shape[2] # reshape, mask np.nan values data = data.reshape((data.shape[0], data.shape[1] * data.shape[2])) data[data == 0.] = np.nan m_stack = marray(data, mask=np.isnan(stack)) n = m_stack.shape[0] new_array = np.zeros_like((data.shape[1], data.shape[2]), dtype=float16) g = tf.get_default_graph() with tf.Session() as sess: saver = tf.train.import_meta_graph('{}.meta'.format(model)) saver.restore(sess, model) pixel = tf.placeholder("float", [None, n]) wh = sess.graph.get_tensor_by_name('Wh:0') wo = sess.graph.get_tensor_by_name('Wo:0') bh = sess.graph.get_tensor_by_name('Bh:0') bo = sess.graph.get_tensor_by_name('Bo:0') classify = tf.add(tf.matmul(multilayer_perceptron(pixel, wh, bh), wo), bo) time = datetime.now() ct_nan = 0 ct_out = 0 for i in range(m_stack.shape[-1]): if not np.ma.is_masked(m_stack[:, i]): dat = m_stack[:, i] dat = array(dat).reshape((1, dat.shape[0])) loss = sess.run(classify, feed_dict={pixel: dat}) new_array[0, i] = np.argmax(loss, 1) ct_out += 1 else: new_array[0, i] = np.nan ct_nan += 1 if i % 1000000 == 0: print('Count {} of {} pixels in {} seconds'.format(i, m_stack.shape[-1], (datetime.now() - time).seconds)) new_array = new_array.reshape(final_shape) with rasopen(out_ras, 'w', **meta) as dst: dst.write(new_array) 提取ubuntu:18.04图像后,我尝试对我的一个子域进行curl调用(我可以通过消息提供它)。

呼叫看起来像这样:docker run -it ubuntu:18.04 bash

该命令挂起并显示以下输出:

curl -vvv -4 api.example.com

我不知道为什么会失败,因为直接从数字海洋服务器进行相同的呼叫是可行的。也可以从Mac上调用子域,也可以直接在浏览器中调用该域。

1 个答案:

答案 0 :(得分:0)

好像是容器中的网络问题,您可以卷曲www.google.com或ping它吗?