4docker Notes
4docker Notes
information on constructs
OR
controlled by Docker.
$docker inspect 55c1595745fc
By default, docker inspect will
render results in a JSON array.
kubectl describe
For example uses of this resourceType
<resource_name>
command, refer to the examples
section below. kubectl describe pod
podName
docker cp
<FILE_TO_COPY_FROM_HOST>
<CONTAINER_ID>:<PATH_INSID
E_CONTAINER_TO_PLACE_THE_F
ILE>
$ docker cp a.py
ubu_container:/home/dir1
Container to HOST
docker cp
<CONTAINER_ID>:<FILE_TO_CO
PY_INSIDE_CONTAINER>
<PATH__IN_HOST_TO_PLACE_FI
LE>
$ docker cp
ubu_container:/home/dir1/n
ew.txt /home/abhishek
Docker image commands
Save an image as tar docker save [OPTIONS] IMAGE [IMAGE…] docker save myrepository:1.0.1 -o
myrepository.tar
file
Save one or more
images to a tar
archive
$docker image ls
List changes to image $docker image history imageId
Delete images $docker rmi imageId
$docker rmi imageId imageId2
Once Dockerfile is defined, we can execute below command to create new image out of it.
$ docker build -t dockerUserId/myImageName:v1 .
COPY ./ ./
COPY ./package.json ./
ADD Similar to COPY If you want to add a xx.tar.gz to
a /usr/local in container, unzip it,
ADD provides additional features like remote and then remove the useless
URL and tar extraction support. compressed package.
For COPY:
COPY resources/jdk-7u79-linux-
x64.tar.gz /tmp/
RUN rm /tmp/jdk-7u79-linux-
x64.tar.gz
For ADD:
ADD resources/jdk-7u79-linux-
x64.tar.gz /usr/local/