Docker: Unterschied zwischen den Versionen

Aus Zovis Wikili
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „= get in to a Docker = docker exec -it [mycontainer or ID] sh“)
 
(get in to a Docker)
Zeile 2: Zeile 2:
  
 
  docker exec -it [mycontainer or ID] sh
 
  docker exec -it [mycontainer or ID] sh
 +
 +
= Dockerfile =
 +
<pre>
 +
```Dockerfile
 +
# Base image to build layer on top
 +
FROM node:18-alpine
 +
 +
# Working directory for build and runtime
 +
WORKDIR /app
 +
 +
# Copy from "build context" into container image
 +
COPY . .
 +
 +
# Run command during build time
 +
RUN npm install
 +
 +
# Instructions what to run when container starts
 +
CMD ["node", "src/index.js"]
 +
</pre>

Version vom 26. Mai 2026, 12:19 Uhr

get in to a Docker

docker exec -it [mycontainer or ID] sh

Dockerfile

```Dockerfile
# Base image to build layer on top
FROM node:18-alpine

# Working directory for build and runtime
WORKDIR /app

# Copy from "build context" into container image
COPY . .

# Run command during build time
RUN npm install

# Instructions what to run when container starts
CMD ["node", "src/index.js"]