I am an Aldryn customer and have troubles to setup their docker environment with Windows 10 and Hyper-V.
Before I used Virtualbox and all was fine, but I could not use interactive shells.
So I really would like to make the switch to Hyper-V.
My docker version Client is: 1.12.0 and I use cmder as my terminal.
I run the aldryn project setup and then do
C:\Users\Hans\myproject [develop +1 ~1 -0 !]
λ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
973098beb1cb myproject_web "/tini -g -- start mi" 3 minutes ago Exited (1) 3 minutes ago myproject_web_run_1
e2f7faa6d8f8 postgres:9.4 "/docker-entrypoint.s" 3 minutes ago Up 3 minutes 5432/tcp myproject_db_1
-
C:\Users\Hans\myproject [develop +1 ~1 -0 !]
λ docker logs 973098beb1cb
no Procfile path defined <<-- this is the error message it's about
My project locally is at C:\Users\Hans\myproject
Then I check within the container:
C:\Users\Hans\myproject [develop +1 ~1 -0 !
λ docker run -i -t myproject_web /bin/bash
root#ed8410007425:/app# ls
Dockerfile addons-dev data.tar.gz gulpfile.js package.json requirements.txt static tools
Procfile bower.json docker-compose-windows.yml manage.py private settings.py static_collected urls.py
addons browserslist docker-compose.yml migrate.sh requirements.in settings.pyc templates wsgi.py
More info:
C:\Users\Hans\myproject [develop +1 ~1 -0 !]
λ docker-compose -f docker-compose-windows.yml up
myproject_db_1 is up-to-date
Starting myproject_web_1
Attaching to myproject_db_1, myproject_web_1
web_1 | python: can't open file 'manage.py': [Errno 2] No such file or directory
Aldryn does not have Windows experts, so they cannot support Windows users.
I hope there are fellow Windows users that might have solved this.
Where does this 'no Procfile path defined' come from?
Could it be a permission problem?
How do I debug this problem?
Related
AFAIK the error means that there is no file named agent.28198 in the mentioned directory, but upon listing its contents the file (local socket file) is clearly there. What could be the reason for docker's inability to get the socket?
Here is the full command scenario:
$ eval $(ssh-agent -s)
Agent pid 28199
$ ssh-add
Enter passphrase for /home/ubuntu/.ssh/id_rsa:
Identity added: /home/ubuntu/.ssh/id_rsa (/home/ubuntu/.ssh/id_rsa)
$ DOCKER_BUILDKIT=1 docker build --ssh default -t my_image .
could not parse ssh: [default]: stat /tmp/ssh-qpL02JZP5k7x/agent.28198: no such file or directory
$ ls -l /tmp/ssh-qpL02JZP5k7x/
total 0
srw------- 1 ubuntu ubuntu 0 Sep 9 08:50 agent.28198
Docker is installed from snap - that's the culprit. It does not have access to /tmp folder because of that. To remediate, remove the package from snap - sudo snap remove docker and install it via dpkg (link).
I am new to docker I have been trying to install oracel-18xe in the docker
after installing Oracele-xe which seems to be working but
after running ./buildContainerImage.sh command
I got the following logs.
Removing intermediate container 3cd9a901da82
---> 3ed5c215ef81
Step 7/8 : HEALTHCHECK --interval=1m --start-period=5m CMD "$ORACLE_BASE/$CHECK_DB_FILE" >/dev/null || exit 1
---> Running in a1c6507ac3b9
Removing intermediate container a1c6507ac3b9
---> f48555c74740
Step 8/8 : CMD exec $ORACLE_BASE/$RUN_FILE
---> Running in c36aec16a658
Removing intermediate container c36aec16a658
---> a347238232be
Successfully built a347238232be
Successfully tagged oracle/database:18.4.0-xe
which seems correct, Then I run the command
sudo docker run --name myxedb -d -p 51521:1521 -p 55500:5500 -e ORACLE_PWD=<secret> -e ORACLE_CHARACTERSET=AL32UTF8 oracle/database:18.4.0-xe
that runs with out error but after running docker logs command
I found the following logs.
sed: can't read /etc/oratab: No such file or directory
/opt/oracle/runOracle.sh: line 194: /etc/init.d/oracle-xe-18c: No such file or directory
grep: /etc/oratab: No such file or directory
#####################################
########### E R R O R ###############
DATABASE SETUP WAS NOT SUCCESSFUL!
Please check output for further info!
########### E R R O R ###############
#####################################
The following output is now a tail of the alert.log:
/opt/oracle/checkDBStatus.sh: line 18: oraenv: No such file or directory
tail: cannot open '/opt/oracle/diag/rdbms/*/*/trace/alert*.log' for reading: No such file or directory
tail: no files remaining
but when I run docker ps command I have not found any container running
then after googling I found an other variation the command
sudo docker run --name myxedb2 -d -i -t -p 51521:1521 -p 55500:5500 -e ORACLE_PWD=<secret> -e ORACLE_CHARACTERSET=AL32UTF8 oracle/database:18.4.0-xe /bin/bash
after that I was able to see the results in the docker ps command.
but docker logs command is showing nothing.
I have some questions here.
first of-all why the first docker run command was not running and docker logs command showing logs which is quite normal.
secondly why the second command is showing all good but docker logs are showing nothing.
and 3rdly the docker images command shows the following out put at my side
REPOSITORY TAG IMAGE ID CREATED SIZE
oracle/database 18.4.0-xe a347238232be 2 days ago 319MB
oraclelinux 7-slim 0a28ba78f4c9 7 weeks ago 132MB
but the forums I am following shows the the size which is quite different from my side.
REPOSITORY TAG IMAGE ID CREATED SIZE
oracle/database 18.4.0-xe 926f4349b277 12 minutes ago 5.89GB
oraclelinux 7-slim 153f8d73287e 8 weeks ago 131MB
Need suggesting and help needed here, thanks advance.
Regards,
I have a docker local registry:2.6.2, and my Web-UI constantly log an error:
time="2019-08-13T13:58:43Z" level=error msg="Failed to retrieve an updated list of tags for http://172.20.0.20:5000" Error="Get http://172.20.0.20:5000/v2/myrepo/tags/list: http: non-successful response (status=404 body=\"{\\\"errors\\\":[{\\\"code\\\":\\
\"NAME_UNKNOWN\\\",\\\"message\\\":\\\"repository name not known to registry\\\",\\\"detail\\\":{\\\"name\\\":\\\"myrepo\\\"}}]}\\n\")" Repository Name=myrepo file=allregistries.go line=71 source=ap
It happens, becouse of empty repository "myrepo" witch exist om my registry.
curl -X GET http://172.20.0.20:5000/v2/_catalog
{"repositories":["myrepo","myrepo2","myrepo3"]}
curl -X GET http://172.20.0.20:5000/v2/myrepo/tags/list
{"errors":[{"code":"NAME_UNKNOWN","message":"repository name not known to registry","detail":{"name":"myrepo"}}]}
The question is, how to delete this empty repository?
NOTE: All below example codes are executed with root privilege on ubuntu 20.04 LTS
I use following command to delete emptry repository
docker exec -it registry sh -c '
for t in $(find /var/lib/registry/docker/registry/v2/repositories -name tags)
do
TAGS=$(ls $t | wc -l)
REPO=${t%%\/_manifests\/tags}
LINKS=$(find $REPO/_manifests/revisions -name link | wc -l)
if [ "$TAGS" -eq 0 -a "$LINKS" -eq 0 ]; then
echo "REMOVE empty repo: $REPO"
rm -rf $REPO
fi
done'
docker restart registry
the registry is the registry that runs on the machine.
you can check the name by docker ps
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d3c40930b56b konradkleine/docker-registry-frontend:v2 "/bin/sh -c $START_S…" About an hour ago Up 42 minutes 80/tcp, 0.0.0.0:30443->443/tcp, :::30443->443/tcp reg-ui
787dd0c13058 registry:2.7.1 "/entrypoint.sh /etc…" 5 days ago Up 34 minutes 0.0.0.0:443->443/tcp, :::443->443/tcp, 5000/tcp registry
#
make sure that both the number of tags and links must be zero.
and the docker process must be restarted, if any directories are removed.
If the command works find, you can create a script
cat<<EOM | tee /usr/local/bin/docker-registry-remove-empty-repo.sh
#!/bin/bash
RM_LOG=\$(docker exec -it registry sh -c '
for t in \$(find /var/lib/registry/docker/registry/v2/repositories -name tags)
do
TAGS=\$(ls \$t | wc -l)
REPO=\${t%%\/_manifests\/tags}
LINKS=\$(find \$REPO/_manifests/revisions -name link | wc -l)
if [ "\$TAGS" -eq 0 -a "\$LINKS" -eq 0 ]; then
echo "REMOVE empty repo: \$REPO"
rm -rf \$REPO
fi
done')
if [ -n "\$RM_LOG" ]; then
echo "\$RM_LOG"
docker restart registry
fi
EOM
chmod +x /usr/local/bin/docker-registry-remove-empty-repo.sh
even you can run it every minutes by registring the script to the cron
sudo sed -i '/docker-registry-remove-empty-repo.sh/d' /var/spool/cron/crontabs/$USER
cat <<EOM | tee -a /var/spool/cron/crontabs/$USER
* * * * * /usr/local/bin/docker-registry-remove-empty-repo.sh
EOM
systemctl restart cron
after that, all is ok, if you see the following system log
# tail -f /var/log/syslog
Jun 7 02:46:01 localhost CRON[38764]: (root) CMD (/usr/local/bin/docker-registry-remove-empty-repo.sh)
Jun 7 02:46:01 localhost CRON[38763]: (CRON) info (No MTA installed, discarding output)
Jun 7 02:47:01 localhost CRON[38774]: (root) CMD (/usr/local/bin/docker-registry-remove-empty-repo.sh)
Jun 7 02:47:01 localhost CRON[38773]: (CRON) info (No MTA installed, discarding output)
Jun 7 02:48:01 localhost CRON[38795]: (root) CMD (/usr/local/bin/docker-registry-remove-empty-repo.sh)
Jun 7 02:48:01 localhost CRON[38794]: (CRON) info (No MTA installed, discarding output)
Jun 7 02:49:01 localhost CRON[38804]: (root) CMD (/usr/local/bin/docker-registry-remove-empty-repo.sh)
Jun 7 02:49:02 localhost CRON[38803]: (CRON) info (No MTA installed, discarding output)
Jun 7 02:50:01 localhost CRON[38814]: (root) CMD (/usr/local/bin/docker-registry-remove-empty-repo.sh)
Jun 7 02:50:01 localhost CRON[38813]: (CRON) info (No MTA installed, discarding output)
^C
#
I have the following Dockerfile that is supposed to start nginx server:
# Set the base image to Ubuntu
FROM ubuntu
# File Author / Maintainer
MAINTAINER myname "myemail#gemail.com"
# Install Nginx
# Add application repository URL to the default sources
# RUN echo "deb http://archive.ubuntu.com/ubuntu/ raring main universe" >> /etc/apt/sources.list
# Update the repository
RUN apt-get update
# Install necessary tools
RUN apt-get install -y nano wget dialog net-tools
# Download and Install Nginx
RUN apt-get install -y nginx
# Remove the default Nginx configuration file
RUN rm -v /etc/nginx/nginx.conf
# Copy a configuration file from the current directory
ADD nginx.conf /etc/nginx/
# Append "daemon off;" to the configuration file
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
# Expose ports
EXPOSE 80
# Set the default command to execute when creating a new container
CMD service nginx start
When I tried to start the image that I created using docker build, I get the following error:
my-MacBook-Pro:nginx-docker me$ docker run -it myname:nginx-latest
2016-07-15T12:57:00.525640076+02:00 container create 0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451 (image=myname:nginx-latest, name=sad_knuth)
2016-07-15T12:57:00.542025710+02:00 container attach 0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451 (image=myname:nginx-latest, name=sad_knuth)
2016-07-15T12:57:00.573835719+02:00 network connect 5e0b48e45380f1548ab524cfa7bfe94ae952ce740df76fda9e35561a258e31ef (container=0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451, name=bridge, type=bridge)
2016-07-15T12:57:00.654772110+02:00 container start 0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451 (image=myname:nginx-latest, name=sad_knuth)
2016-07-15T12:57:00.656973139+02:00 container resize 0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451 (height=42, image=myname:nginx-latest, name=sad_knuth, width=181)
* Starting nginx nginx [fail]
2016-07-15T12:57:00.715136152+02:00 container die 0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451 (exitCode=1, image=myname:nginx-latest, name=sad_knuth)
2016-07-15T12:57:00.757891577+02:00 network disconnect 5e0b48e45380f1548ab524cfa7bfe94ae952ce740df76fda9e35561a258e31ef (container=0220107a0060cf61ff7dcb601870086b4ae7a0b7cacd914d63719e9a3d0d9451, name=bridge, type=bridge)
my-MacBook-Pro:nginx-docker me$
EDIT:
I even tried the following as per the recommendations:
myname-MacBook-Pro:nginx-docker me$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0220107a0060 myname:nginx-latest "/bin/sh -c 'service " 8 minutes ago Exited (1) 8 minutes ago sad_knuth
7252213512f0 myname:nginx-latest "/bin/sh -c 'service " 23 minutes ago Exited (1) 23 minutes ago clever_jennings
53a5e6978978 myname:nginx-latest "/bin/sh -c 'service " 25 minutes ago Exited (1) 25 minutes ago gigantic_dubinsky
10fc9e4b749f myname:nginx-latest "/bin/sh -c 'service " 27 minutes ago Exited (1) 27 minutes ago distracted_almeida
64161feb2b2a 0d73419e8da9 "nginx -g 'daemon off" 3 hours ago Exited (1) 3 hours ago pensive_mcnulty
5c9eab4c7998 hello-world "/hello" 4 hours ago Exited (0) 4 hours ago sharp_kare
myname-MacBook-Pro:nginx-docker me$ docker container 0220107a0060
docker: 'container' is not a docker command.
See 'docker --help'.
myname-MacBook-Pro:nginx-docker me$ docker logs 0220107a0060
* Starting nginx nginx [fail]
CMD service nginx start means the main process exits immediatly after launching nginx.
You would need
CMD /usr/sbin/nginx -g "daemon off;"
To make sure it is not launched in daemon mode.
Other alternatives are here, but I prefer this one as it limits the number of processes to just nginx.
I am learning Docker which is completely new to me. I already was able to create an jboss/wildfly image, and then i was able to start jboss with my application using this Dockerfile:
FROM jboss/wildfly
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-c", "standalone-full.xml", "-b", "0.0.0.0"]
ADD mywebapp-web/target/mywebapp-1.0.war /opt/jboss/wildfly/standalone/deployments/mywebapp-1.0.war
Now i would like to add support for a MySQL Database by adding a datasource to the standalone and the mysql connector. For that i am following this example:
https://github.com/arun-gupta/docker-images/tree/master/wildfly-mysql-javaee7
Following is my dockerfile and my execute.sh script
Dockerfile:
FROM jboss/wildfly:latest
ADD customization /opt/jboss/wildfly/customization/
CMD ["/opt/jboss/wildfly/customization/execute.sh"]
execute script code:
#!/bin/bash
# Usage: execute.sh [WildFly mode] [configuration file]
#
# The default mode is 'standalone' and default configuration is based on the
# mode. It can be 'standalone.xml' or 'domain.xml'.
echo "=> Executing Customization script"
JBOSS_HOME=/opt/jboss/wildfly
JBOSS_CLI=$JBOSS_HOME/bin/jboss-cli.sh
JBOSS_MODE=${1:-"standalone"}
JBOSS_CONFIG=${2:-"$JBOSS_MODE.xml"}
function wait_for_server() {
until `$JBOSS_CLI -c ":read-attribute(name=server-state)" 2> /dev/null | grep -q running`; do
sleep 1
done
}
echo "=> Starting WildFly server"
echo "JBOSS_HOME : " $JBOSS_HOME
echo "JBOSS_CLI : " $JBOSS_CLI
echo "JBOSS_MODE : " $JBOSS_MODE
echo "JBOSS_CONFIG: " $JBOSS_CONFIG
echo $JBOSS_HOME/bin/$JBOSS_MODE.sh -b 0.0.0.0 -c $JBOSS_CONFIG &
$JBOSS_HOME/bin/$JBOSS_MODE.sh -b 0.0.0.0 -c $JBOSS_CONFIG &
echo "=> Waiting for the server to boot"
wait_for_server
echo "=> Executing the commands"
$JBOSS_CLI -c --file=`dirname "$0"`/commands.cli
# Add MySQL module
module add --name=com.mysql --resources=/opt/jboss/wildfly/customization/mysql-connector-java-5.1.39-bin.jar --dependencies=javax.api,javax.transaction.api
# Add MySQL driver
/subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql,driver-xa-datasource-class-name=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource)
# Deploy the WAR
#cp /opt/jboss/wildfly/customization/leadservice-1.0.war $JBOSS_HOME/$JBOSS_MODE/deployments/leadservice-1.0.war
echo "=> Shutting down WildFly"
if [ "$JBOSS_MODE" = "standalone" ]; then
$JBOSS_CLI -c ":shutdown"
else
$JBOSS_CLI -c "/host=*:shutdown"
fi
echo "=> Restarting WildFly"
$JBOSS_HOME/bin/$JBOSS_MODE.sh -b 0.0.0.0 -c $JBOSS_CONFIG
But I get a error when i run the image complaining that a file or directory is not found:
Building Image
$ docker build -t mpssantos/leadservice:latest .
Sending build context to Docker daemon 19.37 MB
Step 1 : FROM jboss/wildfly:latest
---> b8279b641e82
Step 2 : ADD customization /opt/jboss/wildfly/customization/
---> aea03d4f2819
Removing intermediate container 0920e2cd97fd
Step 3 : CMD /opt/jboss/wildfly/customization/execute.sh
---> Running in 8a0dbcb01855
---> 10335320b89d
Removing intermediate container 8a0dbcb01855
Successfully built 10335320b89d
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
Running image
$ docker run mpssantos/leadservice
no such file or directory
Error response from daemon: Cannot start container 5d3357ba17afa36e81d8794f2b0cd45cc00dde955b2b2054282c4ef17dd4f265: [8] System error: no such file or directory
Can someone let me know how can i access the filesystem so i can check which file or directory is complaining? Is there a better way to debug this?
I believe that is something related with the bash which is referred on first line of the script because the following echo is not printed
Thank you so much
I made it to ssh the container to check whats inside.
1) ssh to the docker machine: docker-machine ssh default
2) checked the container id with the command: docker ps -a
3) ssh to the container with the command: sudo docker exec -i -t 665b4a1e17b6 /bin/bash
4) i can check that the "/opt/jboss/wildfly/customization/" directory exists with the expected files
The customization dir have the following permissions and is listed like this:
drwxr-xr-x 2 root root 4096 Jun 12 23:44 customization
drwxr-xr-x 10 jboss jboss 4096 Jun 14 00:15 standalone
and the files inside the customization dir
drwxr-xr-x 2 root root 4096 Jun 12 23:44 .
drwxr-xr-x 12 jboss jboss 4096 Jun 14 00:15 ..
-rwxr-xr-x 1 root root 1755 Jun 12 20:06 execute.sh
-rwxr-xr-x 1 root root 989497 May 4 11:11 mysql-connector-java-5.1.39-bin.jar
if i try to execute the file i get this error
[jboss#d68190e4f0d8 customization]$ ./execute.sh
bash: ./execute.sh: /bin/bash^M: bad interpreter: No such file or directory
Does this bring light to anything?
Thank you so much again
I found the issue. The execute.sh file was with windows eof. I converted to UNIX And start to work.
I believe the execute.sh is not found. You can verify by running the following and finding the result is an empty directory:
docker run mpssantos/leadservice ls -al /opt/jboss/wildfly/customization/
The reason for this is you are doing your build on a different (virtual) machine than your local system, so it's pulling the "customization" folder from that VM. I'd run the build within the VM and place the files you want to import on that VM where the build can find it.