如何在具有ENTRYPOINT的容器上运行bash?
我尝试了:
但是似乎我无法连接。我做错了什么?
FROM ubuntu:18.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update \
&& apt-get install -y curl gnupg
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash \
&& export NVM_DIR="$HOME/.nvm" \
&& [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \
&& [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" \
&& nvm i 8.11 \
&& apt-get install -y mysql-server=5.7.23-0ubuntu0.18.04.1 python3 python3-pip \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& ln -s /usr/bin/pip3 /usr/bin/pip \
&& pip install awscli --upgrade --user \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENTRYPOINT [ "/etc/init.d/mysql", "start" ]
EXPOSE 3306
我尝试了:
jiewmeng@JM ~/Dropbox/ci-docker-node-mysql docker run -it ci-docker-node-mysql bash
* Starting MySQL database server mysqld No directory, logging in with HOME=/
[ OK ]
jiewmeng@JM ~/Dropbox/ci-docker-node-mysql
但是一旦MySQL开始运行,我就被踢了出来。
我尝试运行我的Docker容器...
jiewmeng@JM ~/Dropbox/ci-docker-node-mysql docker run -p 3307:3306 ci-docker-node-mysql
✘ jiewmeng@JM ~/Dropbox/ci-docker-node-mysql mysql -h 127.0.0.1:3307
ERROR 2005 (HY000): Unknown MySQL server host '127.0.0.1:3307' (2)
但是似乎我无法连接。我做错了什么?