The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Deploy a Docker project with Zeit’s Now

Deploy a Docker project with Zeit’s Now

3:06
Use Zeit’s now to deploy a docker container to the cloud quickly and easily. We will see that the process is exactly the same as deploying a Node project. This lesson will also show how log information is displayed on the generated url by `Now` while the app is being deployed.
Watch this lesson now
Avatar
egghead.io

Use Zeit’s now to deploy a docker container to the cloud quickly and easily.

Avatar
Avijit

the Dockerfile command as mentioned, not working. getting 502 error after deployment.

Dockerfile

FROM kstaken/apache2
LABEL name "mydemo-statictest"
RUN apt-get update && apt-get install -y php5 libapache2-mod-php5 php5-mysql
COPY index.html /var/www
EXPOSE 80
CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]

Log

502
An error occured with your deployment.
12/16/16 7:54:15 PM
▲ docker build
12/16/16 7:54:16 PM
Sending build context to Docker daemon 5.12 kB
Sending build context to Docker daemon 5.12 kB

12/16/16 7:54:16 PM
Step 1 : FROM kstaken/apache2
12/16/16 7:54:16 PM
---> 2dde0ff8b71b
12/16/16 7:54:16 PM
Step 2 : LABEL name "mydemo-statictest"
12/16/16 7:54:16 PM
---> Running in 621e443fa74a
12/16/16 7:54:17 PM
---> 1ac85631f9dd
12/16/16 7:54:17 PM
Removing intermediate container 621e443fa74a
12/16/16 7:54:17 PM
Step 3 : RUN apt-get update && apt-get install -y php5 libapache2-mod-php5 php5-mysql
12/16/16 7:54:17 PM
---> Running in ae8c2bb795d0
12/16/16 7:54:18 PM
Ign http://archive.ubuntu.com precise InRelease
12/16/16 7:54:18 PM
Get:1 http://archive.ubuntu.com precise Release.gpg [198 B]
12/16/16 7:54:18 PM
Get:2 http://archive.ubuntu.com precise Release [49.6 kB]
12/16/16 7:54:18 PM
Get:3 http://archive.ubuntu.com precise/main amd64 Packages [1640 kB]
12/16/16 7:54:19 PM
Get:4 http://archive.ubuntu.com precise/main i386 Packages [1641 kB]
12/16/16 7:54:19 PM
Get:5 http://archive.ubuntu.com precise/main TranslationIndex [3706 B]
12/16/16 7:54:20 PM
Get:6 http://archive.ubuntu.com precise/main Translation-en [893 kB]
12/16/16 7:54:20 PM
Fetched 4227 kB in 2s (1628 kB/s)
12/16/16 7:54:20 PM
Reading package lists...
12/16/16 7:54:20 PM
Reading package lists...
12/16/16 7:54:20 PM
Building dependency tree...
12/16/16 7:54:20 PM
Reading state information...
12/16/16 7:54:20 PM
The following extra packages will be installed:
apache2-mpm-prefork libbsd0 libedit2 libmysqlclient18 libxml2 mysql-common
php5-cli php5-common sgml-base ucf xml-core
12/16/16 7:54:20 PM
Suggested packages:
12/16/16 7:54:20 PM
php-pear php5-suhosin sgml-base-doc debhelper
12/16/16 7:54:20 PM
The following packages will be REMOVED:
12/16/16 7:54:20 PM
apache2-mpm-worker
12/16/16 7:54:20 PM
The following NEW packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 libbsd0 libedit2 libmysqlclient18
libxml2 mysql-common php5 php5-cli php5-common php5-mysql sgml-base ucf
xml-core
12/16/16 7:54:21 PM
0 upgraded, 14 newly installed, 1 to remove and 0 not upgraded.
Need to get 8517 kB of archives.
After this operation, 24.6 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ precise/main apache2-mpm-prefork amd64 2.2.22-1ubuntu1 [2402 B]
12/16/16 7:54:21 PM
Get:2 http://archive.ubuntu.com/ubuntu/ precise/main libbsd0 amd64 0.3.0-2 [31.6 kB]
12/16/16 7:54:21 PM
Get:3 http://archive.ubuntu.com/ubuntu/ precise/main libedit2 amd64 2.11-20080614-3ubuntu2 [70.3 kB]
12/16/16 7:54:21 PM
Get:4 http://archive.ubuntu.com/ubuntu/ precise/main libxml2 amd64 2.7.8.dfsg-5.1ubuntu4 [673 kB]
12/16/16 7:54:21 PM
Get:5 http://archive.ubuntu.com/ubuntu/ precise/main mysql-common all 5.5.22-0ubuntu1 [13.7 kB]
12/16/16 7:54:21 PM
Get:6 http://archive.ubuntu.com/ubuntu/ precise/main libmysqlclient18 amd64 5.5.22-0ubuntu1 [946 kB]
12/16/16 7:54:22 PM
Get:7 http://archive.ubuntu.com/ubuntu/ precise/main ucf all 3.0025+nmu2ubuntu1 [54.4 kB]
12/16/16 7:54:22 PM
Get:8 http://archive.ubuntu.com/ubuntu/ precise/main sgml-base all 1.26+nmu1ubuntu1 [8360 B]
12/16/16 7:54:22 PM
Get:9 http://archive.ubuntu.com/ubuntu/ precise/main xml-core all 0.13 [23.4 kB]
12/16/16 7:54:22 PM
Get:10 http://archive.ubuntu.com/ubuntu/ precise/main php5-common amd64 5.3.10-1ubuntu3 [430 kB]
12/16/16 7:54:22 PM
Get:11 http://archive.ubuntu.com/ubuntu/ precise/main libapache2-mod-php5 amd64 5.3.10-1ubuntu3 [3136 kB]
12/16/16 7:54:22 PM
Get:12 http://archive.ubuntu.com/ubuntu/ precise/main php5 all 5.3.10-1ubuntu3 [1072 B]
12/16/16 7:54:22 PM
Get:13 http://archive.ubuntu.com/ubuntu/ precise/main php5-cli amd64 5.3.10-1ubuntu3 [3050 kB]
12/16/16 7:54:22 PM
Get:14 http://archive.ubuntu.com/ubuntu/ precise/main php5-mysql amd64 5.3.10-1ubuntu3 [76.6 kB]
12/16/16 7:54:22 PM
debconf: delaying package configuration, since apt-utils is not installed
12/16/16 7:54:22 PM
Fetched 8517 kB in 1s (4842 kB/s)
12/16/16 7:54:22 PM
dpkg: apache2-mpm-worker: dependency problems, but removing anyway as you requested:
apache2 depends on apache2-mpm-worker (= 2.2.22-1ubuntu1) | apache2-mpm-prefork (= 2.2.22-1ubuntu1) | apache2-mpm-event (= 2.2.22-1ubuntu1) | apache2-mpm-itk (= 2.2.22-1ubuntu1); however:
Package apache2-mpm-worker is to be removed.
Package apache2-mpm-prefork is not installed.
Package apache2-mpm-event is not installed.
Package apache2-mpm-itk is not installed.
12/16/16 7:54:22 PM
(Reading database ... 9880 files and directories currently installed.)
12/16/16 7:54:22 PM
Removing apache2-mpm-worker ...
12/16/16 7:54:22 PM
* Stopping web server apache2
12/16/16 7:54:22 PM
apache2: Could not reliably determine the server's fully qualified domain name, using 10.100.48.43 for ServerName
12/16/16 7:54:22 PM
 ...done.
12/16/16 7:54:25 PM
Selecting previously unselected package apache2-mpm-prefork.
12/16/16 7:54:25 PM
(Reading database ... 9875 files and directories currently installed.)
12/16/16 7:54:25 PM
Unpacking apache2-mpm-prefork (from .../apache2-mpm-prefork2.2.22-1ubuntu1amd64.deb) ...
12/16/16 7:54:25 PM
Setting up apache2-mpm-prefork (2.2.22-1ubuntu1) ...
12/16/16 7:54:25 PM
* Starting web server apache2
12/16/16 7:54:25 PM
apache2: Could not reliably determine the server's fully qualified domain name, using 10.100.48.43 for ServerName
12/16/16 7:54:25 PM
 ...done.
12/16/16 7:54:25 PM
Selecting previously unselected package libbsd0.
12/16/16 7:54:25 PM
(Reading database ... 9880 files and directories currently installed.)
12/16/16 7:54:25 PM
Unpacking libbsd0 (from .../libbsd00.3.0-2amd64.deb) ...
12/16/16 7:54:25 PM
Selecting previously unselected package libedit2.
12/16/16 7:54:25 PM
Unpacking libedit2 (from .../libedit22.11-20080614-3ubuntu2amd64.deb) ...
12/16/16 7:54:25 PM
Selecting previously unselected package libxml2.
12/16/16 7:54:25 PM
Unpacking libxml2 (from .../libxml22.7.8.dfsg-5.1ubuntu4amd64.deb) ...
12/16/16 7:54:25 PM
Selecting previously unselected package mysql-common.
12/16/16 7:54:25 PM
Unpacking mysql-common (from .../mysql-common5.5.22-0ubuntu1all.deb) ...
12/16/16 7:54:25 PM
Selecting previously unselected package libmysqlclient18.
12/16/16 7:54:25 PM
Unpacking libmysqlclient18 (from .../libmysqlclient185.5.22-0ubuntu1amd64.deb) ...
12/16/16 7:54:25 PM
Selecting previously unselected package ucf.
12/16/16 7:54:25 PM
Unpacking ucf (from .../ucf3.0025+nmu2ubuntu1all.deb) ...
12/16/16 7:54:25 PM
Moving old data out of the way
12/16/16 7:54:25 PM
Selecting previously unselected package sgml-base.
12/16/16 7:54:25 PM
Unpacking sgml-base (from .../sgml-base1.26+nmu1ubuntu1all.deb) ...
12/16/16 7:54:25 PM
Selecting previously unselected package xml-core.
12/16/16 7:54:25 PM
Unpacking xml-core (from .../archives/xml-core0.13all.deb) ...
12/16/16 7:54:25 PM
Selecting previously unselected package php5-common.
12/16/16 7:54:25 PM
Unpacking php5-common (from .../php5-common5.3.10-1ubuntu3amd64.deb) ...
12/16/16 7:54:25 PM
Selecting previously unselected package libapache2-mod-php5.
12/16/16 7:54:25 PM
Unpacking libapache2-mod-php5 (from .../libapache2-mod-php55.3.10-1ubuntu3amd64.deb) ...
12/16/16 7:54:25 PM
Selecting previously unselected package php5.
12/16/16 7:54:25 PM
Unpacking php5 (from .../php55.3.10-1ubuntu3all.deb) ...
12/16/16 7:54:25 PM
Selecting previously unselected package php5-cli.
12/16/16 7:54:25 PM
Unpacking php5-cli (from .../php5-cli5.3.10-1ubuntu3amd64.deb) ...
12/16/16 7:54:26 PM
Selecting previously unselected package php5-mysql.
12/16/16 7:54:26 PM
Unpacking php5-mysql (from .../php5-mysql5.3.10-1ubuntu3amd64.deb) ...
12/16/16 7:54:26 PM
Setting up libbsd0 (0.3.0-2) ...
12/16/16 7:54:26 PM
Setting up libedit2 (2.11-20080614-3ubuntu2) ...
12/16/16 7:54:26 PM
Setting up libxml2 (2.7.8.dfsg-5.1ubuntu4) ...
12/16/16 7:54:26 PM
Setting up mysql-common (5.5.22-0ubuntu1) ...
12/16/16 7:54:26 PM
Setting up libmysqlclient18 (5.5.22-0ubuntu1) ...
12/16/16 7:54:26 PM
Setting up ucf (3.0025+nmu2ubuntu1) ...
12/16/16 7:54:26 PM
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
12/16/16 7:54:26 PM
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
12/16/16 7:54:26 PM
Setting up sgml-base (1.26+nmu1ubuntu1) ...
12/16/16 7:54:26 PM
Setting up xml-core (0.13) ...
12/16/16 7:54:26 PM
Setting up php5-common (5.3.10-1ubuntu3) ...
12/16/16 7:54:26 PM
Setting up libapache2-mod-php5 (5.3.10-1ubuntu3) ...
12/16/16 7:54:26 PM
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
12/16/16 7:54:26 PM
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
12/16/16 7:54:26 PM

Creating config file /etc/php5/apache2/php.ini with new version
12/16/16 7:54:26 PM
 * Restarting web server apache2
12/16/16 7:54:26 PM
apache2: Could not reliably determine the server's fully qualified domain name, using 10.100.48.43 for ServerName
12/16/16 7:54:27 PM
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 10.100.48.43 for ServerName
12/16/16 7:54:27 PM
 ...done.
12/16/16 7:54:27 PM
Setting up php5 (5.3.10-1ubuntu3) ...
12/16/16 7:54:27 PM
Setting up php5-cli (5.3.10-1ubuntu3) ...
12/16/16 7:54:28 PM
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
12/16/16 7:54:28 PM
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
12/16/16 7:54:28 PM

Creating config file /etc/php5/cli/php.ini with new version
12/16/16 7:54:28 PM
update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode.
12/16/16 7:54:28 PM
Setting up php5-mysql (5.3.10-1ubuntu3) ...
12/16/16 7:54:28 PM
Processing triggers for libc-bin ...
12/16/16 7:54:28 PM
ldconfig deferred processing now taking place
12/16/16 7:54:30 PM
---> 7479b64b8e8e
12/16/16 7:54:30 PM
Removing intermediate container ae8c2bb795d0
12/16/16 7:54:30 PM
Step 4 : COPY index.html /var/www
12/16/16 7:54:31 PM
---> 80c76d0d7410
12/16/16 7:54:31 PM
Removing intermediate container aab8f1a4a691
12/16/16 7:54:31 PM
Step 5 : EXPOSE 80
12/16/16 7:54:31 PM
---> Running in a1d8b842d3e0
12/16/16 7:54:32 PM
---> 751ebee3884b
12/16/16 7:54:32 PM
Removing intermediate container a1d8b842d3e0
12/16/16 7:54:32 PM
Step 6 : CMD /usr/sbin/apache2 -D FOREGROUND
12/16/16 7:54:32 PM
---> Running in a83de16a9921
12/16/16 7:54:33 PM
---> a4082f099893
12/16/16 7:54:33 PM
Removing intermediate container a83de16a9921
Successfully built a4082f099893
12/16/16 7:54:34 PM
▲ Storing image
12/16/16 7:54:55 PM
▲ Deploying image
12/16/16 7:55:00 PM
▲ Container started
12/16/16 7:55:01 PM
apache2: Could not reliably determine the server's fully qualified domain name, using 172.28.0.4 for ServerName

In reply to egghead.io
Avatar
Avijit

I have solved it by using "--static" parameter

In reply to Avijit
Avatar
Avijit

Now, I have one more query. How to do the similar thing using nginx server? I tried like below,

FROM nginx
LABEL name "mydemo-nginxapp"
RUN apt-get update
COPY index.html /var/www
EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]

I have used "--static" parameter. irrespective of using this parameter I am getting 502 error. Any idea how to resolve it?

In reply to Avijit
Avatar
mykola

I would definitely recommend using Zeit's slack channel for technical help - the devs all hang out there and are great at answering questions!

In reply to Avijit
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?