Answer the question
In order to leave comments, you need to log in
How to mount a folder to a container in kubernetes?
Good afternoon. Please tell me, I created a deployment for my container.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: app
name: app
spec:
replicas: 1
selector:
matchLabels:
app: app
template:
metadata:
labels:
app: app
spec:
containers:
- image: app
imagePullPolicy: Never
name: app
ports:
- containerPort: 11080
volumeMounts:
- mountPath: /var/www
name: env-app
securityContext:
privileged: true
volumes:
- name: env-app
hostPath:
path: /.
type: Directory
FROM php:7.1-fpm-alpine
ENV COMPOSER_HOME="/usr/local/composer"
ENV PHP_XDEBUG_DEFAULT_ENABLE ${PHP_XDEBUG_DEFAULT_ENABLE:-1}
ENV PHP_XDEBUG_REMOTE_ENABLE ${PHP_XDEBUG_REMOTE_ENABLE:-1}
ENV PHP_XDEBUG_REMOTE_HOST ${PHP_XDEBUG_REMOTE_HOST:-"127.0.0.1"}
ENV PHP_XDEBUG_REMOTE_PORT ${PHP_XDEBUG_REMOTE_PORT:-9000}
ENV PHP_XDEBUG_REMOTE_AUTO_START ${PHP_XDEBUG_REMOTE_AUTO_START:-1}
ENV PHP_XDEBUG_REMOTE_CONNECT_BACK ${PHP_XDEBUG_REMOTE_CONNECT_BACK:-1}
ENV PHP_XDEBUG_IDEKEY ${PHP_XDEBUG_IDEKEY:-docker}
ENV PHP_XDEBUG_PROFILER_ENABLE ${PHP_XDEBUG_PROFILER_ENABLE:-0}
ENV PHP_XDEBUG_PROFILER_OUTPUT_DIR ${PHP_XDEBUG_PROFILER_OUTPUT_DIR:-"/tmp"}
RUN \
addgroup -g 1000 -S user && \
adduser -u 1000 -D -S -G user user && \
\
apk update && \
apk upgrade && \
\
apk add --no-cache \
$PHPIZE_DEPS \
supervisor \
nodejs \
nodejs-npm \
yarn \
dcron \
composer \
tini \
libintl \
icu \
icu-dev \
libxml2-dev \
postgresql-dev \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
gmp \
gmp-dev \
libmemcached-dev \
imagemagick-dev \
libssh2 \
libssh2-dev \
libxslt-dev && \
\
docker-php-ext-configure gd \
--with-freetype-dir=/usr/include/ \
--with-jpeg-dir=/usr/include/ && \
\
pecl install -o -f redis \
&& docker-php-ext-enable redis && \
\
pecl install memcached \
&& docker-php-ext-enable memcached && \
\
docker-php-ext-install -j"$(getconf _NPROCESSORS_ONLN)" \
intl \
bcmath \
xsl \
zip \
soap \
mysqli \
pdo \
pdo_mysql \
pdo_pgsql \
gmp \
iconv \
gd && \
\
pecl install \
xdebug && \
docker-php-ext-enable xdebug && \
\
composer global require hirak/prestissimo && \
\
chmod a+rw -R ${COMPOSER_HOME} && \
\
apk del \
$PHPIZE_DEPS
WORKDIR /var/www
Answer the question
In order to leave comments, you need to log in
This is most likely the case: path: /.
If you want to refer to the current directory in Linux, then it will be. ./
Keep in mind that in h8s host this is not the machine from which you deploy, but the one on which the pod with containers will be launched. Accordingly, you should first create the desired directory on the host and place the necessary files there, and then mount it using the absolute path.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question