arun kamboj
arun kamboj

Reputation: 1315

How to extract project code from docker to local system

I want to extract my sailsjs project code (From docker) into my local system (Linux machine).

I run the following command

docker exec -it containername_or_ID /bin/bash

I am able to view my code by using this command. but i am unable to get this code into my local system.

Any Idea to get the code into local system

Upvotes: 4

Views: 21479

Answers (3)

Nilesh Attarde
Nilesh Attarde

Reputation: 64

you can map host folder with docker container with -v option. docker run -v /my-app:/my-app

The advantage of docker volume is that you can work on your code on the fly. so there is no need to copy code from host to container or vice-versa

Upvotes: 0

SiHa
SiHa

Reputation: 8411

Sometimes it's easy to overlook the simplest solutions. You can just copy the code onto your local filesystem with docker cp

docker cp containername:/path/to/files /local/path

Upvotes: 11

bxN5
bxN5

Reputation: 1430

When runs container:

docker run -v /hostPathToCode/path:/containerPathToCode

The question is how you get source code there, inside container? Container should not have any source code or anything which you possibly need to save after container destroying

p/s docker exec gives possibility just to ssh to the container

Upvotes: 0

Related Questions