Copying built OpenCV from one Docker image to another
Using this Dockerfile
with just the important parts highlighted for simplicity:
RUN cd /opencv-$OPENCV_VERSION/cmake_binary
&& cmake -DBUILD_TIFF=ON
&& make install
## Compress the openCV files so you can extract them from the docker easily
RUN tar cvzf opencv-$OPENCV_VERSION.tar.gz --directory=$OPENCV_INSTALL_PATH .
Now, I want to build my application in a new container, so as far as I understand the documentation I can go:
FROM docker-opencv-cuda:cv3.3.1_cuda8 AS opencv
COPY -from=opencv /opencv/ /opencv/
However, I get an error:
invalid from flag value opencv: pull access denied for opencv, repository does not exist or may require 'docker login'
Looking around, it seems that COPY -from
is trying to reference either a private or public repository, but I'd like it to look for my local version as docker image ls
reports:
REPOSITORY TAG IMAGE ID
docker-opencv-cuda cv3.3.1_cuda8 xxxx
docker-opencv-cuda cv3.3.1_cuda9 yyyy
How can I do what I want to do? Adding to a repository is not a valid option as later I will have proprietary code that I cannot share, etc.
UPDATE: I might have found a bug? I have Docker 18.09.0, and given the lines:
ARG CV_VERSION=cv3.3.1_cuda8
FROM docker-opencv-cuda:$CV_VERSION AS opencv
COPY -from=opencv /opencv/ /opencv/
COPY -from=docker-opencv-cuda:$CV_VERSION /opencv/ /opencv/
COPY -from=docker-opencv-cuda:cv3.3.1_cuda8 /opencv/ /opencv/
Only the third COPY
with the full -from
label works.
UPDATE 2: Docker newbie problem. My Dockerfile
is incorrect as -from
should not refer to the current FROM
, so this is OK and does what I want:
ARG CV_VERSION=cv3.3.1_cuda8
FROM docker-opencv-cuda:$CV_VERSION AS opencv
# Switch context so the OpenCV files no longer exist in the current image
FROM another_package
COPY -from=opencv /opencv/ /opencv/
COPY -from=docker-opencv-cuda:$CV_VERSION /opencv/ /opencv/
COPY -from=docker-opencv-cuda:cv3.3.1_cuda8 /opencv/ /opencv/
docker opencv dockerfile
add a comment |
Using this Dockerfile
with just the important parts highlighted for simplicity:
RUN cd /opencv-$OPENCV_VERSION/cmake_binary
&& cmake -DBUILD_TIFF=ON
&& make install
## Compress the openCV files so you can extract them from the docker easily
RUN tar cvzf opencv-$OPENCV_VERSION.tar.gz --directory=$OPENCV_INSTALL_PATH .
Now, I want to build my application in a new container, so as far as I understand the documentation I can go:
FROM docker-opencv-cuda:cv3.3.1_cuda8 AS opencv
COPY -from=opencv /opencv/ /opencv/
However, I get an error:
invalid from flag value opencv: pull access denied for opencv, repository does not exist or may require 'docker login'
Looking around, it seems that COPY -from
is trying to reference either a private or public repository, but I'd like it to look for my local version as docker image ls
reports:
REPOSITORY TAG IMAGE ID
docker-opencv-cuda cv3.3.1_cuda8 xxxx
docker-opencv-cuda cv3.3.1_cuda9 yyyy
How can I do what I want to do? Adding to a repository is not a valid option as later I will have proprietary code that I cannot share, etc.
UPDATE: I might have found a bug? I have Docker 18.09.0, and given the lines:
ARG CV_VERSION=cv3.3.1_cuda8
FROM docker-opencv-cuda:$CV_VERSION AS opencv
COPY -from=opencv /opencv/ /opencv/
COPY -from=docker-opencv-cuda:$CV_VERSION /opencv/ /opencv/
COPY -from=docker-opencv-cuda:cv3.3.1_cuda8 /opencv/ /opencv/
Only the third COPY
with the full -from
label works.
UPDATE 2: Docker newbie problem. My Dockerfile
is incorrect as -from
should not refer to the current FROM
, so this is OK and does what I want:
ARG CV_VERSION=cv3.3.1_cuda8
FROM docker-opencv-cuda:$CV_VERSION AS opencv
# Switch context so the OpenCV files no longer exist in the current image
FROM another_package
COPY -from=opencv /opencv/ /opencv/
COPY -from=docker-opencv-cuda:$CV_VERSION /opencv/ /opencv/
COPY -from=docker-opencv-cuda:cv3.3.1_cuda8 /opencv/ /opencv/
docker opencv dockerfile
add a comment |
Using this Dockerfile
with just the important parts highlighted for simplicity:
RUN cd /opencv-$OPENCV_VERSION/cmake_binary
&& cmake -DBUILD_TIFF=ON
&& make install
## Compress the openCV files so you can extract them from the docker easily
RUN tar cvzf opencv-$OPENCV_VERSION.tar.gz --directory=$OPENCV_INSTALL_PATH .
Now, I want to build my application in a new container, so as far as I understand the documentation I can go:
FROM docker-opencv-cuda:cv3.3.1_cuda8 AS opencv
COPY -from=opencv /opencv/ /opencv/
However, I get an error:
invalid from flag value opencv: pull access denied for opencv, repository does not exist or may require 'docker login'
Looking around, it seems that COPY -from
is trying to reference either a private or public repository, but I'd like it to look for my local version as docker image ls
reports:
REPOSITORY TAG IMAGE ID
docker-opencv-cuda cv3.3.1_cuda8 xxxx
docker-opencv-cuda cv3.3.1_cuda9 yyyy
How can I do what I want to do? Adding to a repository is not a valid option as later I will have proprietary code that I cannot share, etc.
UPDATE: I might have found a bug? I have Docker 18.09.0, and given the lines:
ARG CV_VERSION=cv3.3.1_cuda8
FROM docker-opencv-cuda:$CV_VERSION AS opencv
COPY -from=opencv /opencv/ /opencv/
COPY -from=docker-opencv-cuda:$CV_VERSION /opencv/ /opencv/
COPY -from=docker-opencv-cuda:cv3.3.1_cuda8 /opencv/ /opencv/
Only the third COPY
with the full -from
label works.
UPDATE 2: Docker newbie problem. My Dockerfile
is incorrect as -from
should not refer to the current FROM
, so this is OK and does what I want:
ARG CV_VERSION=cv3.3.1_cuda8
FROM docker-opencv-cuda:$CV_VERSION AS opencv
# Switch context so the OpenCV files no longer exist in the current image
FROM another_package
COPY -from=opencv /opencv/ /opencv/
COPY -from=docker-opencv-cuda:$CV_VERSION /opencv/ /opencv/
COPY -from=docker-opencv-cuda:cv3.3.1_cuda8 /opencv/ /opencv/
docker opencv dockerfile
Using this Dockerfile
with just the important parts highlighted for simplicity:
RUN cd /opencv-$OPENCV_VERSION/cmake_binary
&& cmake -DBUILD_TIFF=ON
&& make install
## Compress the openCV files so you can extract them from the docker easily
RUN tar cvzf opencv-$OPENCV_VERSION.tar.gz --directory=$OPENCV_INSTALL_PATH .
Now, I want to build my application in a new container, so as far as I understand the documentation I can go:
FROM docker-opencv-cuda:cv3.3.1_cuda8 AS opencv
COPY -from=opencv /opencv/ /opencv/
However, I get an error:
invalid from flag value opencv: pull access denied for opencv, repository does not exist or may require 'docker login'
Looking around, it seems that COPY -from
is trying to reference either a private or public repository, but I'd like it to look for my local version as docker image ls
reports:
REPOSITORY TAG IMAGE ID
docker-opencv-cuda cv3.3.1_cuda8 xxxx
docker-opencv-cuda cv3.3.1_cuda9 yyyy
How can I do what I want to do? Adding to a repository is not a valid option as later I will have proprietary code that I cannot share, etc.
UPDATE: I might have found a bug? I have Docker 18.09.0, and given the lines:
ARG CV_VERSION=cv3.3.1_cuda8
FROM docker-opencv-cuda:$CV_VERSION AS opencv
COPY -from=opencv /opencv/ /opencv/
COPY -from=docker-opencv-cuda:$CV_VERSION /opencv/ /opencv/
COPY -from=docker-opencv-cuda:cv3.3.1_cuda8 /opencv/ /opencv/
Only the third COPY
with the full -from
label works.
UPDATE 2: Docker newbie problem. My Dockerfile
is incorrect as -from
should not refer to the current FROM
, so this is OK and does what I want:
ARG CV_VERSION=cv3.3.1_cuda8
FROM docker-opencv-cuda:$CV_VERSION AS opencv
# Switch context so the OpenCV files no longer exist in the current image
FROM another_package
COPY -from=opencv /opencv/ /opencv/
COPY -from=docker-opencv-cuda:$CV_VERSION /opencv/ /opencv/
COPY -from=docker-opencv-cuda:cv3.3.1_cuda8 /opencv/ /opencv/
docker opencv dockerfile
docker opencv dockerfile
edited Nov 16 '18 at 2:57
Ken Y-N
asked Nov 16 '18 at 2:03
Ken Y-NKen Y-N
7,838134773
7,838134773
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
First map your local disk when start docker and copy data from docker into the local disk.
such as:
$ docker run --it -rm -v /your_path:/your_path your_image
# cp -rf /opencv /your_path
# exit
Then create your new docker, and copy the data from the local.
I was thinking about that as a workaround and I might just adopt that since as I note in my updateCOPY -from
looks dodgy.
– Ken Y-N
Nov 16 '18 at 2:15
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330437%2fcopying-built-opencv-from-one-docker-image-to-another%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
First map your local disk when start docker and copy data from docker into the local disk.
such as:
$ docker run --it -rm -v /your_path:/your_path your_image
# cp -rf /opencv /your_path
# exit
Then create your new docker, and copy the data from the local.
I was thinking about that as a workaround and I might just adopt that since as I note in my updateCOPY -from
looks dodgy.
– Ken Y-N
Nov 16 '18 at 2:15
add a comment |
First map your local disk when start docker and copy data from docker into the local disk.
such as:
$ docker run --it -rm -v /your_path:/your_path your_image
# cp -rf /opencv /your_path
# exit
Then create your new docker, and copy the data from the local.
I was thinking about that as a workaround and I might just adopt that since as I note in my updateCOPY -from
looks dodgy.
– Ken Y-N
Nov 16 '18 at 2:15
add a comment |
First map your local disk when start docker and copy data from docker into the local disk.
such as:
$ docker run --it -rm -v /your_path:/your_path your_image
# cp -rf /opencv /your_path
# exit
Then create your new docker, and copy the data from the local.
First map your local disk when start docker and copy data from docker into the local disk.
such as:
$ docker run --it -rm -v /your_path:/your_path your_image
# cp -rf /opencv /your_path
# exit
Then create your new docker, and copy the data from the local.
answered Nov 16 '18 at 2:14
Kinght 金Kinght 金
8,48031841
8,48031841
I was thinking about that as a workaround and I might just adopt that since as I note in my updateCOPY -from
looks dodgy.
– Ken Y-N
Nov 16 '18 at 2:15
add a comment |
I was thinking about that as a workaround and I might just adopt that since as I note in my updateCOPY -from
looks dodgy.
– Ken Y-N
Nov 16 '18 at 2:15
I was thinking about that as a workaround and I might just adopt that since as I note in my update
COPY -from
looks dodgy.– Ken Y-N
Nov 16 '18 at 2:15
I was thinking about that as a workaround and I might just adopt that since as I note in my update
COPY -from
looks dodgy.– Ken Y-N
Nov 16 '18 at 2:15
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330437%2fcopying-built-opencv-from-one-docker-image-to-another%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown