我需要能够分叉一个进程。据我所知,我需要设置security-opt。我试过用docker命令做这个,它工作正常。但是,当我在docker-compose文件中执行此操作时,它似乎什么都不做,也许我没有使用compose。
filename_queue = tf.train.slice_input_producer([files_left, files_right, files_mask])
t_image_left = tf.read_file(filename_queue[0], name='read_fileimage_left')
t_image_right = tf.read_file(filename_queue[1], name='read_fileimage_right')
t_image_mask = tf.read_file(filename_queue[2], name='read_fileimage_mask')
t_left = tf.image.decode_png(t_image_left, name='decode_png_t_left', dtype=tf.uint8)
t_right = tf.image.decode_png(t_image_right, name='decode_png_t_right', dtype=tf.uint8)
t_mask = tf.image.decode_png(t_image_mask, name='decode_png_t_mask', dtype=tf.uint8
batch_left, batch_right, batch_mask = tf.train.batch([t_left, t_right, t_mask], batch_size=32, num_threads=1,
capacity=500, enqueue_many=False,)
搬运工-compose.yml
docker run --security-opt=seccomp:unconfined <id> dlv debug --listen=:2345 --headless --log ./cmd/main.go
Dockerfile
networks:
backend:
services:
example:
build: .
security_opt:
- seccomp:unconfined
networks:
- backend
ports:
- "5002:5002"
命令
FROM golang:1.8
RUN go get -u github.com/derekparker/delve/cmd/dlv
RUN dlv debug --listen=:2345 --headless --log ./cmd/main.go
2017/09/04 15:58:33 server.go:73:使用API v1 2017/09/04 15:58:33 debugger.go:97:使用args启动进程:[/ go / src / debug]不能 启动过程:fork / exec / go / src / debug:不允许操作
答案 0 :(得分:2)
撰写语法正确。但是security_opt将应用于容器的新实例,因此在构建时不可用,就像您尝试使用Dockerfile RUN
命令一样。
正确的方法应该是:
Dockerfile:
FROM golang:1.8
RUN go get -u github.com/derekparker/delve/cmd/dlv
docker-compose.yml
networks:
backend:
services:
example:
build: .
security_opt:
- seccomp:unconfined
networks:
- backend
ports:
- "5002:5002"
entrypoint: ['/usr/local/bin/dlv', '--listen=: 2345', '--headless=true', '--api-version=2', 'exec', 'cmd/main.go']